如何在节点更新后修复损坏的npm

时间:2021-06-04 13:47:04

I updated node to 7.9.0 with homebrew. Now whenever I do anything with npm I get the following error:

我用自制软件将节点更新到7.9.0。现在每当我用npm做任何事情时,我都会收到以下错误:

$ node -v
v7.9.0
$ npm -v
module.js:472
    throw err;
    ^

Error: Cannot find module '../lib/utils/unsupported.js'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:79:3)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)

I have tried uninstalling and reinstalling node with no change. What can I try to recover from this?

我尝试卸载并重新安装节点,没有任何更改。我可以尝试从中恢复什么?

1 个解决方案

#1


19  

try to remove /usr/local/lib/node_modules/npm and reinstall node again, this should work.

尝试删除/ usr / local / lib / node_modules / npm并重新安装节点,这应该工作。

#1


19  

try to remove /usr/local/lib/node_modules/npm and reinstall node again, this should work.

尝试删除/ usr / local / lib / node_modules / npm并重新安装节点,这应该工作。