Nvm 安装

Nvm 安装

1、**ls -a **查看文件

2touch ~/.bash_profile 没有bash_profile文件新建文件

3、如果有或者新建完成后,我们通过官方的说明在终端中运行下面命令中的一种进行安装:

  • curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash 使用这个

  • wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash

4、在跟目录下会有个 .nvm 的文件地址:/Users/fangfei/.nvm

5、会自动在**.bash_profile** 文件里面添加,无需自己添加

export NVM_DIR="$HOME/.nvm"

[ -s “KaTeX parse error: Expected 'EOF', got '&' at position 19: …_DIR/nvm.sh" ] &̲& . "NVM_DIR/nvm.sh” # This loads nvm

[ -s “KaTeX parse error: Expected 'EOF', got '&' at position 28: …_completion" ] &̲& . "NVM_DIR/bash_completion” # This loads nvm bash_completion

6、此时cmd还是没有nvm

需要新建 .zshrc 文件,这个文件是命令终端启动的时候回调用

新建:touch .zshrc

source ~/.bash_profile

// 下面两个是配置代理GitHub时需要配置的

alias proxy_on=‘export http_proxy=http://127.0.0.1:7890;export https_proxy=http://127.0.0.1:7890;’ # 设置终端代理

alias proxy_off=‘unset http_proxy https_proxy’ # 取消终端代理

重新启动一下: source .zshrc

到此为止,nvm 安装成功

这里说明下GitHub代理设置的使用

source ~/.zshrc

打开代理:proxy_on

关闭代理:proxy_off

注意:

在安装比低的版本,比如10.15.3

就是安装失败,报错信息

error Target architecture arm64 is only supported on arm64 and x64 host

需要使用

arch -x86_64 zsh

有些下载版本在src中的也是需要该命令

还有报错信息

wasm code commit Allocation failed - process out of memory

电脑型号:Apple Mbp M1

解决方式:

$ nvm uninstall 14

$ arch -x86_64 zsh

$ nvm install 14

$ nvm alias default 14

如果nvm 下载慢

解决办法:NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node

export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node

查看npm安装路径信息 npm root -g

查看npm 源 npm get registry

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇

)">
下一篇>>