Npm install cannot find module 'semver'

后端 未结 26 1522
南方客
南方客 2020-11-29 15:29

I can\'t use npm install using the command prompt in NodeJS. I\'m getting these errors when running npm install:

module.js:339
             


        
26条回答
  •  忘掉有多难
    2020-11-29 15:59

    I had the same error. npm uninstall npm -g, rm -rf node_modules didn't help me, because when I tried I was getting Error: Cannot find module 'semver'. But I solve my problem with these steps (this will delete other global modules you may be using):

    • sudo rm -rf /usr/local/lib/node_modules
    • sudo rm -rf ~/.npm
    • brew uninstall --force node
    • brew install node

    Hope this will help those who are getting a similar problem.

提交回复
热议问题