[英]unable to switch version of node from 8 to 10 on mac
I tried various options available over the internet as listed below, but still node v8 is there even though I restarted my system as well-我尝试了下面列出的 Internet 上可用的各种选项,但即使我重新启动了系统,node v8 仍然存在 -
sudo npm install n -g
sudo n stable
npm install -g n
sudo npm cache clean -f sudo npm install -g n sudo n stable
brew update brew upgrade brew upgrade node
brew update && brew upgrade node && npm update -g npm
sudo npm cache clean -f sudo npm install -g n
sudo rm -rf /opt/local/bin/node /opt/local/include/node
/opt/local/lib/node_modules sudo rm -rf /usr/local/bin/npm
/usr/local/share/man/man1/node.1 /usr/local/lib/dtrace/node.d
brew uninstall --force node brew unlink node brew install node@10
use NVM to switch node versions, you can use the install script directly, restart the shell and start using it like: 使用NVM切换节点版本,您可以直接使用安装脚本,重新启动Shell并开始使用它,如下所示:
nvm install <node_version>
if you want to get the list of available versions you can: 如果要获取可用版本的列表,则可以:
nvm ls-remote
if you want to see what versions has already been installed: 如果要查看已经安装了什么版本:
nvm ls
to switch a version is: 切换版本是:
nvm use <node_version> # the version should be already installed using nvm install
and to set up a default version you can alias it like this: 并设置默认版本,您可以使用以下别名:
nvm alias default nvm别名默认
Hope it helps. 希望能帮助到你。
Mac OS with nvm installed.安装了 nvm 的 Mac 操作系统。 I was trying to change node from 10 to 12.
我试图将节点从 10 更改为 12。
In my case, nvm use *.*
didn't work.就我而言,
nvm use *.*
不起作用。 It used to work once with nvm use 10
, but later when I needed to switch to Node 12, nvm use 12
didn't work for me like other attempts to change.它曾经与
nvm use 10
一起工作一次,但后来当我需要切换到 Node 12 时, nvm use 12
对我不起作用,就像其他尝试改变一样。
So the steps that helped:所以有帮助的步骤:
which -a node
showed me that I have multiple paths to the node: which -a node
向我展示了我有多个到达该节点的路径: `` ``
/usr/local/opt/node@10/bin
/Users/username/.nvm/versions/node/v12.22.7/bin/node
/opt/local/bin/node
/usr/local/bin/node
/usr/local/opt/node@10/bin
in the files:/usr/local/opt/node@10/bin
的行: ~/.bash_profile
~/.zshrc
nvm use [version]
command on my Mac.nvm use [version]
命令。 Maybe it help someone.也许它可以帮助某人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.