I have generated express application with express-generator
,everything works fine until i deleted the node_modules
folder.
after reinstall the node-modules nodemon
is not starting the application.
[nodemon] starting
node app.js
[nodemon] clean exit - waiting for changes before restart
Here is the package.json file
{
"name": "testapp",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"build": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.18.2",
"cookie-parser": "~1.4.3",
"cors": "^2.8.4",
"csurf": "^1.9.0",
"debug": "~2.6.9",
"express": "~4.15.5",
"express-session": "^1.15.6",
"jade": "~1.11.0",
"morgan": "~1.9.0",
"serve-favicon": "~2.4.5"
},
"main": "app.js",
}
This is not an issue of nodemon, this error occurs when the file you are running with nodemon is ended its execution(i.e. scripts that do not run continuously).
I have cloned your repo and working fine for me so you should be running nodemon app.js
.
If you are generating app with express generator your app.js is not the file that listens to the server. Actually, bin/www
file is the one that starts listening and the app only create server object.
So nodemon ./bin/www
should do the trick for you.
you can also edit package.json and add following in the code
"scripts": {
"start": "node ./bin/www",
"dev": "nodemon ./bin/www"
}
And then run npm run dev
.