问题描述
我正在使用具有最新macOS(10.12.3)的Macbook,并且通过运行以下命令安装了Homebrew:
I'm using a Macbook with the latest macOS (10.12.3), and I installed Homebrew by running:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
之后,我安装了节点:
brew install node
并尝试对其进行升级:
> brew upgrade node
> Error: node 7.8.0 already installed
我收到一个错误消息,说已经安装了7.8.0版本,这是我刚刚安装的最新版本所期望的.
I got an error saying the version 7.8.0 is already installed, that was expected since I had just installed the most recent version.
问题:在我运行的终端上:
> node --version
> v4.4.5
,并恢复了显然已经安装的旧版本.另外,当我通过 npm
安装一些新软件包时,会收到警告,提示该软件包需要较新版本的node.
and got back an old version that apparently was already installed. Also, when I install some new package through npm
I get a warning saying the package requires an newer version of node.
问题::我的Mac上似乎同时安装了两个版本的节点,如何使用最新版本的节点?以及如何卸载所有其他旧节点版本?
Question: I seem to have both versions of node installed on my mac, how can I use the most current one? And how can I uninstall all other older node versions?
非常感谢您的帮助!
推荐答案
我的问题已按照评论中的@ theWanderer4865建议解决.
My problem was solved following @theWanderer4865 suggestions in the comments.
首先,我在执行的终端中卸载了通过brew:安装的节点版本:
First, I uninstalled the node version I had installed through brew: in the terminal I executed:
> brew cleanup
> brew uninstall node
第二,我通过运行删除了已安装的所有其他节点版本:
Second, I removed all other node versions I had installed by running:
> rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
第三,使用 nvm
重新安装节点:
Third, install node again using nvm
:
> nvm install node
这篇关于Brew安装后,节点使用了错误的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!