TheCraccer
TheCraccer

Reputation: 25

NodeJs does not start

Edit: I changed the title for this question because it seemed more accurate.

So this is my package.json file:

{
 "name": "application-name",
 "version": "0.0.1",
 "private": true,
 "scripts": {
 "start": "node ./bin/www"
},
 "dependencies": {
 "express": "~4.0.0",
 "static-favicon": "~1.0.0",
 "morgan": "~1.0.0",
 "cookie-parser": "~1.0.1",
 "body-parser": "~1.0.0",
 "debug": "~0.7.4",
 "jade": "~1.3.0",
 "mongodb": "*",
 "monk": "*"
 }
}

I don't really get an error after hitting npm install but it seems like node didn't install all dependencies. Because when we hit the exact same code on my collegue's pc his promt said a lot more feedback on installed dependencies and it worked fine there.

When i now hit "npm start" it just terminates after a few seconds without any response.

I know there is a bug with node at the moment and i already tried to clear my npm chache and adding the "npm update" command and it still doesn't work.

It seems like its a problem with my pc because, like i said, on my collegue's pc everything worked fine. I hope you have any ideas what could be the problem. Thanks a lot in advance!

Edit: Here's what the npm list command gives me:

├─┬ [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └─┬ [email protected]
│   └── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   ├── [email protected]
│ │   ├── [email protected]
│ │   └── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   ├── [email protected]
│ │   ├─┬ [email protected]
│ │   │ └── [email protected]
│ │   ├─┬ [email protected]
│ │   │ └── [email protected]
│ │   └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   └─┬ [email protected]
│ │     ├── [email protected]
│ │     └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │   ├─┬ [email protected]
│ │   │ └── [email protected]
│ │   └─┬ [email protected]
│ │     └── [email protected]
│ └─┬ [email protected]
│   └─┬ [email protected]
│     ├── [email protected]
│     ├─┬ [email protected]
│     │ └── [email protected]
│     ├─┬ [email protected]
│     │ └── [email protected]
│     └── [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   └── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
└── [email protected]

So it really looks like the dependencies have been installed (if I'm not completely wrong?). Still my "npm start" command terminates after just a few seconds... any guesses?

Upvotes: 0

Views: 23808

Answers (3)

Bhoopalan Thaati
Bhoopalan Thaati

Reputation: 43

Not sure if this is resolved or ignored and found a workaround. Just had gone through the problem myself and found out that the problem was not with NodeJS but with one of the dependencies. I failed to install ejs and all my files are ejs based. So I got the same error as you.

So it is best to check if all your dependencies are installed properly.

Upvotes: 0

user4023394
user4023394

Reputation:

if the cursor is returning on node app.js(server.js or whatever the name of the js is) like shown below

c:/users/<project-path>:node app.js
c:/users/<project-path>:

Then you might be using express 4 generator So try the following command

set DEBUG=<project-folder-name>:* & npm start 

Upvotes: 0

Alexander
Alexander

Reputation: 4023

If you cleared the npm cache, try also removing all folders in your app's node_modules and run npm install again.
You might want to try starting your app in DEBUG mode and see if it gives you any hint:

DEBUG=express:* node ./bin/www 

Upvotes: 1

Related Questions