javascript - Unable to install npm nodemon - Stack Overflow

I am trying to install npm package nodemon by running this command:npm i nodemon -gAnd I am receiving

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
  • Are you able to do any other npm operations? It looks like npm installation is damaged. Try to uninstall node with provided uninstaller and reinstall again – Estus Flask Commented Mar 6 at 18:43
  • Back up a moment: why do you need 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
  • @Mike'Pomax'Kamermans I am using Node v22.14.0 – Mbulelo Tshabane Commented Mar 7 at 5:41
  • (remember to say that in your post, not in a comment) – Mike 'Pomax' Kamermans Commented Mar 7 at 5:42
  • But also again: are you sure you need nodemon? (Because if you really think you do, node has --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
Add a comment  | 

2 Answers 2

Reset to default 1

If nodemon isn't working, you can use Nodejs watch function.

node --watch path/to/main.js

There can be 3 reasons behind it:

  1. Try clearing the npm cache:

npm cache clean --force
npm i -g nodemon

  1. If your npm is outdated then update it:

npm install -g npm

  1. Reinstall your node.js. It might be broken.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744956611a4603230.html

相关推荐

  • javascript - Unable to install npm nodemon - Stack Overflow

    I am trying to install npm package nodemon by running this command:npm i nodemon -gAnd I am receiving

    1天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信