简体   繁体   English

更新了NPM,但仍显示为旧版本

[英]Updated NPM but still showing as old version

Getting "npm: command not found" on this computer. 在此计算机上获取“npm:command not found”。 Only way I knew to get it was by uninstalling node with Homebrew and reinstalling from the node.js site. 我知道的唯一方法是通过使用Homebrew卸载节点并从node.js站点重新安装。 Just reinstalled node.js on this computer and have npm version 2.5.1 with it. 刚刚在这台计算机上重新安装了node.js,并使用npm版本2.5.1。 I went to update to the newest (2.7.1) using: 我使用以下内容更新到最新版本(2.7.1):

sudo npm install npm -g

Updated without any errors, but running npm -v tells me I'm still on version 2.5.1 更新没有任何错误,但运行npm -v告诉我,我仍然在2.5.1版本

In the process of looking into the issue, see that old npm related files are on this computer. 在查看问题的过程中,请查看此计算机上的旧npm相关文件。 Old Changelog last modified 30 days ago exists saying "v2.7.1 (2015-03-05)" so npm was updated and on here at one point. 旧的Changelog最后修改30天前存在说“v2.7.1(2015-03-05)”所以npm已经更新并且在这里一度更新。

Can anyone point me in the right direction to figure out what is going wrong? 谁能指出我正确的方向来弄清楚出了什么问题?

Making some assumptions here: there isn't anything really wrong, there just might be some installation issues. 在这里做一些假设:没有任何真正的错误,可能存在一些安装问题。 Homebrew should be just fine for installing node, Thoughtbot uses it to set-up laptops (see here ). Homebrew应该适合安装节点,Thoughtbot使用它来设置笔记本电脑(见这里 )。

To make sure Node/NPM installation is done in a smooth way, I did this: 为确保Node / NPM安装顺利完成,我这样做了:

sudo chown -R $USER /usr/local

Per this post. 根据这篇文章。

I am on Yosemite and I haven't had any issues using this set-up, especially when updating NPM (did it when I read your question). 我在优胜美地,我没有遇到任何使用此设置的问题,尤其是在更新NPM时(在我阅读您的问题时这样做)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM