I am trying to install npm package nodemon by running this command:
npm i nodemon -g
And I am receiving this error message below:
npm error code MODULE_NOT_FOUND
npm error path \?\C:\Program Files\nodejs\node_modules\npm\node_modules\tuf-js\node_modules\make-fetch-happen\package.json
npm error Cannot find module 'C:\Program Files\nodejs\node_modules\npm\node_modules\tuf-js\node_modules\make-fetch-happen\lib\index.js'. Please verify that the package.json has a valid "main" entry
npm error A complete log of this run can be found in: C:\Users\mbulelo.tshabane\AppData\Local\npm-cache_logs\2025-03-06T14_33_24_047Z-debug-0.log
I have tried the following command as well below:
npm install nodemon --save-dev
Still same error message received.
I am trying to install npm package nodemon by running this command:
npm i nodemon -g
And I am receiving this error message below:
npm error code MODULE_NOT_FOUND
npm error path \?\C:\Program Files\nodejs\node_modules\npm\node_modules\tuf-js\node_modules\make-fetch-happen\package.json
npm error Cannot find module 'C:\Program Files\nodejs\node_modules\npm\node_modules\tuf-js\node_modules\make-fetch-happen\lib\index.js'. Please verify that the package.json has a valid "main" entry
npm error A complete log of this run can be found in: C:\Users\mbulelo.tshabane\AppData\Local\npm-cache_logs\2025-03-06T14_33_24_047Z-debug-0.log
I have tried the following command as well below:
npm install nodemon --save-dev
Still same error message received.
Share Improve this question edited Mar 6 at 19:10 Mike 'Pomax' Kamermans 53.8k17 gold badges125 silver badges176 bronze badges asked Mar 6 at 18:32 Mbulelo TshabaneMbulelo Tshabane 133 bronze badges 5 |2 Answers
Reset to default 1If nodemon isn't working, you can use Nodejs watch function.
node --watch path/to/main.js
There can be 3 reasons behind it:
- Try clearing the npm cache:
npm cache clean --force
npm i -g nodemon
- If your npm is outdated then update it:
npm install -g npm
- Reinstall your node.js. It might be broken.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744956611a4603230.html
nodemon
? Because "restarting on file changes" may have been useful back in the node 4 days, but these days you want "hot-swap my code without restarting anything, I have a state to preserve". That said: which version of Node are you using? – Mike 'Pomax' Kamermans Commented Mar 6 at 19:10--watch
built in, which does the same thing natively, so are you sure you need nodemon?) – Mike 'Pomax' Kamermans Commented Mar 7 at 19:01