解决Error: Cannot find module ‘are-we-there-yet‘ npm无法使用

今天登陆服务器提示这个 ,并且npm无法运行

module.js:557
    throw err;
    ^

Error: Cannot find module 'are-we-there-yet'
    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.<anonymous> (/root/.nvm/versions/node/v9.4.0/lib/node_modules/npm/node_modules/npmlog/log.js:2:16)
    at Module._compile (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)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `npm config delete prefix` or `nvm use --delete-prefix v9.4.0 --silent` to unset it.

这些修复方法都不行,因为我无论执行任何npm命令,都会报错。

npm config delete prefix
npm cache clean -f

使用这个方法修复了

cd /usr/local/lib/node_modules
curl -L https://www.npmjs.com/install.sh | sh

你可能感兴趣的:(npm,linux)