求助:npm 安装错误 npm ERR! Darwin 13.4.0
发布于 10 年前 作者 SoaringTiger 51013 次浏览 最后一次编辑是 8 年前 来自 问答

用n stable 升级到0.12后,npm就出错了,google了一下,不少人说 用 npm cache clear 一下就可以解决,结果我连 npm cache clear 都出错 log如下: 0 info it worked if it ends with ok 1 verbose cli [ ‘node’, ‘/usr/local/bin/npm’, ‘cache’, ‘clear’ ] 2 info using npm@2.5.1 3 info using node@v0.12.0 4 verbose stack Error: Cannot find module './spawn’ 4 verbose stack at Function.Module._resolveFilename (module.js:336:15) 4 verbose stack at Function.Module._load (module.js:278:25) 4 verbose stack at Module.require (module.js:365:17) 4 verbose stack at require (module.js:384:17) 4 verbose stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/git.js:9:13) 4 verbose stack at Module._compile (module.js:460:26) 4 verbose stack at Object.Module._extensions…js (module.js:478:10) 4 verbose stack at Module.load (module.js:355:32) 4 verbose stack at Function.Module._load (module.js:310:12) 4 verbose stack at Module.require (module.js:365:17) 4 verbose stack at require (module.js:384:17) 5 verbose cwd /Users/abc/WebstormProjects/test 6 error Darwin 13.4.0 7 error argv “node” “/usr/local/bin/npm” “cache” "clear" 8 error node v0.12.0 9 error npm v2.5.1 10 error code MODULE_NOT_FOUND 11 error Cannot find module ‘./spawn’

3 回复

试尽各种办法,最后还是手动卸载了再重装了npm 1、sudo npm uninstall npm -g 如果步骤1卸不掉npm了(我就是这种情况) 2、进到npm的安装目录 /usr/local/lib/node_modules/npm/ sudo make uninstall 3、手动重装npm curl -L https://npmjs.com/install.sh | sh 然后,终于搞定了!抓狂啊!

果然重装才是王道

果然,我也是!哈哈!

回到顶部