NPM was installed. I attempt to update and find it's no longer installed

女生的网名这么多〃 提交于 2019-12-11 04:25:14

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/37735653/npm-was-installed-i-attempt-to-update-and-find-its-no-longer-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!