安装了 NPM.我尝试更新并发现它不再安装 [英] NPM was installed. I attempt to update and find it's no longer installed
问题描述
我使用他们网站上的
好吧,你的 npm 升级失败了,这意味着:
指向实际脚本的符号链接/usr/local/bin/npm 已被删除,但在尝试删除实际 npm 文件时失败,因此从未重新安装新的符号链接
实际上删除了/usr/local/lib/node_modules/npm 的东西,但没有删除文件夹,因此升级失败.
npm 应该像这样从/usr/local/bin 指向:
npm ->../lib/node_modules/npm/bin/npm-cli.js
希望有所帮助.如果实际的 npm-cli.js 文件真的消失了,最好的办法是重新安装 node,然后使用 sudo 升级.
I installed Node on El Capitan using the package from their website.
I check to see if npm
is installed and it shows version 2.15.5
is installed.
I then routinely check to see if there's an update and accidentally forget to use sudo
. I retry again using sudo
and it fails saying npm
command isn't found.
Both which npm
and whereis npm
fail to return anything.
What's going on?
Well, your npm upgrade failed, which means that either:
the symlink /usr/local/bin/npm that pointed to the actual script was removed, but it failed when trying to remove the actual npm files and hence, never reinstalled a new symlink
the /usr/local/lib/node_modules/npm stuff actually got removed, but not the folder, hence the upgrade failed.
npm should point like this from /usr/local/bin:
npm -> ../lib/node_modules/npm/bin/npm-cli.js
Hope that helps. If the actual npm-cli.js file is actually gone, your best bet is to just re-install node and then upgrade with sudo.
这篇关于安装了 NPM.我尝试更新并发现它不再安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!