2
votes

There must have some simple solution with this problem. I have created a new project using Webstorm for Express js + Node js. Then i installed nodemon using npm install -g nodemon and it was fine. But when i am trying to start my app using nodemon app.js it is showing only

sany2k8@sany2k8-Aspire-4752:/var/projects/ENStack$ nodemon app.js

[nodemon] 1.9.2

[nodemon] to restart at any time, enter rs [nodemon] watching: .

[nodemon] starting node app.js

[nodemon] clean exit - waiting for changes before restart

package.json

{
  "name": "ENStack",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.13.2",
    "cookie-parser": "~1.3.5",
    "debug": "~2.2.0",
    "express": "~4.13.1",
    "jade": "~1.11.0",
    "morgan": "~1.6.1",
    "serve-favicon": "~2.3.0"
  }
}

Edit: When i tried with npm start then it is showing bunch of errors

sany2k8@sany2k8-Aspire-4752:/var/projects/ENStack$ npm start

[email protected] start /var/projects/ENStack node ./bin/www

Port 3000 is already in use

2
I remember having same problem but long long ago, and it was related to npm permissions. yours however dosen't seems to be so, but have you installed it with proper permission?Abhinav Gauniyal
yes @AbhinavGauniyalAlways Sunny
have you checked your processes to verify that it isn't running? No error messages?Abhinav Gauniyal
is app.js working when you run node app.js ?mh-cbon
What are the errors your receive ? Port 3000 is already in use happens when you're running another node app in another process at port 3000.Osama Salama

2 Answers

2
votes

we need to add start with nodemon ./bin/www in the json file and run your project using: nodemon app

{
  "name": "ENStack",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "nodemon ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.13.2",
    "cookie-parser": "~1.3.5",
    "debug": "~2.2.0",
    "express": "~4.13.1",
    "jade": "~1.11.0",
    "morgan": "~1.6.1",
    "serve-favicon": "~2.3.0"
  }
}
0
votes

Additionally, some times, the port are in use. If the solution above not work for you, try change the port. It may be in use for some other node instance.