清除caching后npm不工作

在清除caching之前

npm cache clear 

npm工作正常。 清除caching后,它不工作。 下面的错误日志表明与互联网连接的问题,但互联网连接就好了。 这个问题不仅发生在凉亭,而且还发生在任何模块上。

以下是过程的输出:

 > sudo npm install -g bower Password: npm http GET > https://registry.npmjs.org/bower npm http GET > https://registry.npmjs.org/bower npm http GET > https://registry.npmjs.org/bower npm ERR! network connect ETIMEDOUT > npm ERR! network This is most likely not a problem with npm itself npm > ERR! network and is related to network connectivity. npm ERR! network > In most cases you are behind a proxy or have bad network settings. npm > ERR! network npm ERR! network If you are behind a proxy, please make > sure that the npm ERR! network 'proxy' config is set properly. See: > 'npm help config' > > npm ERR! System Darwin 12.5.0 npm ERR! command > "/usr/local/Cellar/node/0.10.16/bin/node" "/usr/local/bin/npm" > "install" "-g" "bower" npm ERR! cwd /Users/username npm ERR! > node -v v0.10.16 npm ERR! npm -v 1.3.8 npm ERR! syscall connect npm > ERR! code ETIMEDOUT npm ERR! errno ETIMEDOUT npm ERR! npm ERR! > Additional logging details can be found in: npm ERR! > /Users/username/npm-debug.log npm ERR! not ok code 0 

它应该是

 npm cache clean 

请参阅https://www.npmjs.org/doc/cli/npm-cache.html

“从npm @ 5开始,npmcaching可以从腐败问题中自行修复,并且从caching中提取的数据保证是有效的。如果要确保一切都一致,请使用

'npm cache verify'

代替。”

这对我工作:

 npm cache clean --force 

环境path可能已被删除。

通过input来检查它,

npm config get prefix

这必须是发现npm二进制文件的位置。

在Windows中, c:/users/username/AppData/Roaming/npm是他们被发现的地方。

将此位置添加到环境variables。 它应该工作正常。

(控制面板 – >search'环境variables',然后点击一个带有该名称的button – >编辑path – >添加上面的位置)