I have been trying to install the MEAN stack using the following tutorial:
http://www.bossable.com/303/install-mean-stack/#comment-1526
I am using webstorm and MongoDB.
However I have been unsuccessful and I keep getting errors. Everytime I connect to localhost:3000 I get the following error:
C:\meanproject>grunt
Running "jshint:all" (jshint) task
>> 55 files lint free.
Running "csslint:all" (csslint) task
>> 2 files lint free.
Running "concurrent:default" (concurrent) task
Running "nodemon:dev" (nodemon) task
Running "watch" task
Waiting...
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/views/**/*.* gruntfile.js server.js config/**/*.js app/*
*/*.js
[nodemon] starting `node --debug server.js`
Debugger listening on port 5858
Application loaded using the "development" environment configuration
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
MEAN.JS application started on port 3000
C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\connection
\base.js:246
throw message;
^
Error: Error setting TTL index on collection : sessions
at C:\meanproject\node_modules\connect-mongo\lib\connect-mongo.js:169:23
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\db.
js:1499:46
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\db.
js:1632:20
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\cur
sor.js:170:22
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\cur
sor.js:714:39
at Cursor.close (C:\meanproject\node_modules\mongoose\node_modules\mongodb\l
ib\mongodb\cursor.js:1009:5)
at commandHandler (C:\meanproject\node_modules\mongoose\node_modules\mongodb
\lib\mongodb\cursor.js:714:21)
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\db.
js:1905:9
at Server.Base._callHandler (C:\meanproject\node_modules\mongoose\node_modul
es\mongodb\lib\mongodb\connection\base.js:453:41)
at C:\meanproject\node_modules\mongoose\node_modules\mongodb\lib\mongodb\con
nection\server.js:488:18
at MongoReply.parseBody (C:\meanproject\node_modules\mongoose\node_modules\m
ongodb\lib\mongodb\responses\mongo_reply.js:68:5)
at null.<anonymous> (C:\meanproject\node_modules\mongoose\node_modules\mongo
db\lib\mongodb\connection\server.js:446:20)
at emit (events.js:107:17)
at null.<anonymous> (C:\meanproject\node_modules\mongoose\node_modules\mongo
db\lib\mongodb\connection\connection_pool.js:207:13)
at emit (events.js:110:17)
at Socket.<anonymous> (C:\meanproject\node_modules\mongoose\node_modules\mon
godb\lib\mongodb\connection\connection.js:440:22)
[nodemon] app crashed - waiting for file changes before starting...
How would I go about solving this?
You need to run the mongodb.exe file first. After successfully starting mongodb, you need to navigate into your project folder and run 'grunt'. If it shows you a error list of modules not found, you need to install those modules globally with npm. That will solve the problem for you. However, please note that bossable.com tutorial is for 0.3 mean stack boiler plate. They have upgraded their version to 0.4.1 now. Follow the Meanjs documentation
for latest information.
Related
So, basically I am setting up my local server using node.js and nodemon. It starts well on localhost but when I refresh the page or open another page, the server crashes giving me this unhandled 'error' event. I have searched through some solutions and tried reinstalling the dependencies after removing the cache by using npm cache clean --force. There is an image attached showing the error.
When I start my server using nodemon
After refreshing the landing page or going to other page
In case these images doesn't show up this is my whole return from vs code from starting the server to when I refresh the page or navigate to another page:
> nodemon app.js
[nodemon] 2.0.12
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node app.js`
server listening on port: 5000
events.js:377
throw er; // Unhandled 'error' event
^
Error [ERR_STREAM_WRITE_AFTER_END]: write after end
at writeAfterEnd (_http_outgoing.js:694:15)
at ServerResponse.end (_http_outgoing.js:815:7)
at Server.<anonymous> (C:\Users\SUJAL\OneDrive\Desktop\VS code\web development\NodeJs\nodejs\app.js:17:7)
at Server.emit (events.js:400:28)
at parserOnIncoming (_http_server.js:897:12)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
Emitted 'error' event on ServerResponse instance at:
at writeAfterEndNT (_http_outgoing.js:753:7)
at processTicksAndRejections (internal/process/task_queues.js:83:21) {
code: 'ERR_STREAM_WRITE_AFTER_END'
}
[nodemon] app crashed - waiting for file changes before starting...
If you can even help with a temporarily solution, it will be great.
Make sure the port you're using is not in use by other services. Or, use a different port.
I had the same issue. Later realized port 5000 was being used by another service on my pc. Switched it to a different one and worked fine.
When ever I try to execute npm start, this is what happens. I think there is some issue with powershell and not with npm because npm starts the development server. BTW I created basic react app using npx create-react-app. I checked, powershell file is there in the specified location and it is working as well. Guild me what should I do in order to resolve the error.
events.js:353
throw er; // Unhandled 'error' event
^
Error: spawn C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
at onErrorNT (internal/child_process.js:467:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell',
path: 'C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
'UwB0AGEAcgB0ACAAIgBoAHQAdABwADoALwAvAGwAbwBjAGEAbABoAG8AcwB0ADoAMwAwADAAMAAiAA=='
]
}
I faced with a same problem on Windows 10.
And solution was a pretty simple - just run your commands in git bush console.
Step 1:(reason of the error)
go to C:\Windows\System32\WindowsPowerShell\v1.0 and then you will not be found powershell.exe file that folder.
Step 2: (solution of the error)
download powershell.exe file online or just copy and paste this file in C:\Windows\System32\WindowsPowerShell\v1.0
https://www.exefiles.com/en/exe/powershell-exe/ - To download powershell.exe file online
So after trying everything and looking for the error on every possible website. I still wasn't able to resolve the error. Then I personally talked to someone regarding the error and he suggested me to run it in Windows Sub-system for Linux (WSL). I exactly did that and installed WSL with Linux 20.04 LTS. Now I am using Unix terminal to create the react app. It isn't the best solution for the problem, but yeah it does work and saves a lot of time!
I'm running http://socketcluster.io/ and I want to restart my workers whewnever a file changes. However, nodemon server.js fails as soon as it tries to restart with an endlessly-repeating wall of:
1445633138359 - Origin: Worker (PID 44372)
[Error] Error: connect ECONNREFUSED /var/folders/fj/yzfd3_tn7xd0smz7j6s093mh0000gn/T/socketcluster/6879fe94-ed92-4188-b1d7-cb187a5ade4e_b68fcded6c/b0
at Object.exports._errnoException (util.js:874:11)
at exports._exceptionWithHostPort (util.js:897:20)
at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
1445633138362 - Worker 0 exited - Exit code: 0
How can I safely restart SocketCluster to load the new changes?
nodemon sends the SIGUSR2 signal to the main (Master) process. SocketCluster (correctly) interprets this as as a request to reboot the workers. Unfortunately, there's an open issue where things are not shut down properly and errors fly all around.
There are two options:
You can add the code from the linked issue:
house.addShutdownHandler(function(ctx, next){
socketCluster.killWorkers();
socketCluster.killBrokers();
next();
});
or use forever to send a "restart everything" signal:
forever -w --killSignal=SIGTERM server.js
Improvements were made for nodemon in SC version 5.0.23 or later.
Make sure that you pass killMasterOnSignal: true when instantiating SocketCluster in your code (server.js file) - This setting is necessary for nodemon to work.
I have created a MEAN stack application on https://openshift.redhat.com/ and it was successfully running on the web.
Default source code of the project synced form: https://github.com/linnovate/mean-on-openshift.git
For further development I am cloning the hosted git source using using git url mentioned in the applications page. (e.g git clone ssh://55e86e9f89f5cf1d29000001#nodejs-tapslab.rhcloud.com/~/git/nodejs.git/).
After clone the source code to local system, opening the project in sublime text editor. I can see in the config/env/development.js there are lot of configuration are used like process.env.OPENSHIFT_XXX. I was changed the some config value mentioned below and trying to start server using command : 'node server', but server was not starting throwing error.
{
db: db: 'mongodb://' + (process.env.DB_PORT_27017_TCP_ADDR || 'localhost:27017') + ':' + '/mean-dev',
hostname: process.env.OPENSHIFT_NODEJS_IP || 'http://localhost:3000'
}
Can someone help me how to run Openshift mean project in local system and what all configuration needed before running it in local system.
System Config :
Ubuntu 12.04
MongoDB v2.6.6
Nodejs v0.10.40
npm 1.4.28
grunt-cli v0.1.13
Error :
$ node server
Mean app started on port 3000 (development)
events.js:72
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND
at errnoException (dns.js:37:11)
at Object.onanswer [as oncomplete] (dns.js:124:16)
Git:
$ NODE_ENV=test node server
I follower every instruction for installing a MEAN stack application.
At the end of it all I run grunt and when I go to http://localhost:3000 I get the following error:
Running "clean:0" (clean) task
Running "jshint:all" (jshint) task
>> 47 files lint free.
Running "csslint:src" (csslint) task
>> 5 files lint free.
Running "concurrent:tasks" (concurrent) task
Running "nodemon:dev" (nodemon) task
Running "watch" task
Waiting...
[nodemon] v1.0.20
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node --debug server.js`
debugger listening on port 5858
Mongoose: packages.findOne({ name: 'config' }) { fields: undefined }
3000
Mean app started on port 3000 (development)
Mongoose: users.ensureIndex({ email: 1 }) { safe: undefined, background: true, unique: true }
Mongoose: users.ensureIndex({ username: 1 }) { safe: undefined, background: true, unique: true }
GET / 304 41.185 ms - -
events.js:72
throw er; // Unhandled 'error' event
^
Error: ENOENT, open '/var/www/finnviz/bower_components/bootstrap/dist/css/bootstrap.css'
[nodemon] app crashed - waiting for file changes before starting...
I searched and found this answer, but this does not seem to be the case, when I run ps aux | grep node I dont get any running process:
trufa 14763 0.0 0.0 23492 956 pts/14 S+ 15:39 0:00 grep --color=auto node
I searched through many answers but none seem to apply. Some suggest to change the port. I tried it and the error is the same.
Any suggestions as to how to proceed?
Sometimes the automatic bower install does not work if you run npm with sudo.
I would recommend setting up npm so it does not require sudo.
Try running $ bower install from your project root, and then restart the server.
you had run another server using the same port 8080.