I've been using the nodemon
package, but I'm experiencing issues with it not restarting the server properly. Instead of showing "server running" after making changes like in tutorials, all it displays is "restarting due to changes". This also results in my work not updating when viewed in a browser.
I've researched numerous related questions on Stack Overflow and tried various solutions like installing dependencies locally as devdependent and changing script tags in the package.json
file, but nothing seems to be working.
I've attempted different commands such as nodemon
, npm start
, nodemon app.js
,
nodemon lib/dev-server.js --delay 1
, nodemon -L
, and many others, but none have resolved the issue.
================================================================================= edited question:
Currently, I am using VS Code and trying to run JavaScript code with the Express framework. Even a basic hello world code is failing to run with nodemon in my Git Bash terminal. Here are the steps I've followed:
node -v
and npm -v
both work fine on my Bash terminal.
I created a simple hello world express app by using npm init
and npm install express --save
Here's the link to my testApp GitHub repository: https://github.com/webdevshiv/testApp.git
The main problem lies with nodemon. I installed nodemon with npm install nodemon --save-dev
and also tried nodemon install -g
. In the script tag,
"scripts": { "start": "node app.js" }
was added. When attempting to run nodemon with nodemon app.js
, I encountered the error:(bash: nodemon: command not found)
However, node app.js
is working without any problems. Upon using npx nodemon app.js
, the output showed "Example app listening at http://localhost:3000 [nodemon] restarting due to changes..." which indicates that nodemon isn't functioning correctly despite being able to detect changes.
Previously, nodemon was operational under normal circumstances, but now it has completely stopped working...
I've included my system environment variable path for reference:
C:\Program Files\MongoDB\Server\4.2\bin;C:\Program Files\Git\cmd; C:\Program Files\nodejs; C:\Program Files\nodejs\node_modules\npm
For visual aids, here are links to screenshots from my VS Code setup: https://i.sstatic.net/7cslK.jpg https://i.sstatic.net/HaFOf.jpg