最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - "module.js:557 throw err" when running npm from terminal - Stack Overflow

programmeradmin0浏览0评论

when I run npm from terminal I get this error and nothing else. no npm mand is working, all of them are giving the same error and I can't even install programs that are depending on nodejs.

$ npm module.js:557 throw err; ^

Error: Cannot find module 'semver'

at Function.Module._resolveFilename (module.js:555:15)

at Function.Module._load (module.js:482:25)

at Module.require (module.js:604:17)

at require (internal/module.js:11:18)

at Object. (/usr/lib/node_modules/npm/lib/utils/unsupported.js:2:14)

at Module._pile (module.js:660:30)

at Object.Module._extensions..js (module.js:671:10)

at Module.load (module.js:573:32)

at tryModuleLoad (module.js:513:12)

at Function.Module._load (module.js:505:3)

when I run npm from terminal I get this error and nothing else. no npm mand is working, all of them are giving the same error and I can't even install programs that are depending on nodejs.

$ npm module.js:557 throw err; ^

Error: Cannot find module 'semver'

at Function.Module._resolveFilename (module.js:555:15)

at Function.Module._load (module.js:482:25)

at Module.require (module.js:604:17)

at require (internal/module.js:11:18)

at Object. (/usr/lib/node_modules/npm/lib/utils/unsupported.js:2:14)

at Module._pile (module.js:660:30)

at Object.Module._extensions..js (module.js:671:10)

at Module.load (module.js:573:32)

at tryModuleLoad (module.js:513:12)

at Function.Module._load (module.js:505:3)

Share Improve this question edited Jan 21, 2018 at 8:06 fool-dev 7,7779 gold badges44 silver badges56 bronze badges asked Jan 21, 2018 at 7:02 Deepak SuryaDeepak Surya 431 silver badge10 bronze badges 3
  • 1 Your npm module may be corrupted or some not suitable module versions are installed. I heard similar problems earlier. Take a look at those urls for workaround solutions at least... stackoverflow./questions/33870520/… and github./coreybutler/nvm-windows/issues/302 – ayortanli Commented Jan 21, 2018 at 8:22
  • I updated semver manually and the problem was fixed, but i got another error "cb() never called" so i was fed up and switched to yarn package manager. Either way, thanks bruh! – Deepak Surya Commented Jan 22, 2018 at 8:39
  • See if https://stackoverflow./questions/53545800#62740853 helps. – Henke Commented Jul 5, 2020 at 15:28
Add a ment  | 

1 Answer 1

Reset to default 6

This did the trick for me (I'm using OSX)

sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall --force node
brew install node
发布评论

评论列表(0)

  1. 暂无评论