nvm
node
a version management tool for ---24d1331fb10ad9307ee31bdb1fa97aad---, it is essential in front-end development, but because of the particularity of GitHub
, many people are unable to The installation was successful with the official tutorial. This article aims to sort out a silky installation tutorial like Dove.
The installation method described in this article can be understood as installing through a warehouse mirror. If you can access GitHub
, you don't need to install it through this article.
Warehouse Address:
- GitHub: https://github.com/ineo6/nvm
- GitLab: https://gitlab.com/mirrorx/nvm
Install
script
You can use any of the following scripts for installation. Note that there is no ---5b889b93a8a1ec4fd5aa44297ca6478c mac
on wget
.
export NVM_SOURCE=https://gitlab.com/mirrorx/nvm.git
curl -o- https://gitlab.com/mirrorx/nvm/-/raw/master/install.sh | bash
export NVM_SOURCE=https://gitlab.com/mirrorx/nvm.git
wget -qO- https://gitlab.com/mirrorx/nvm/-/raw/master/install.sh | bash
Verify that the installation was successful
command -v nvm
If it displays nvm
after execution, it means that the installation has been successful.
If you encounter the problem that the nvm
command cannot be found, please refer to the "FAQ" at the end of this article.
renew
Just re-execute the installation script.
configure
1. Set as the system default node
Because nvm
the results of the installation are in the following format:
/Users/neo/.nvm/versions/node/v14.17.4/bin/node
shell
ide
中都可以正常工作,我们需要设置把nvm
安装的node
.
nvm alias default node
2. Set up the node image
Here is to set up the mirror for installation node
.
export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node
nvm install node
// 或者
NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node nvm install 4.2
Long term replacement can use the following settings:
echo 'export NVM_NODEJS_ORG_MIRROR="https://npmmirror.com/mirrors/node"' >> ~/.zshrc
Notice! The above script writes the configuration to the file .zshrc
, if you don't know about it, please refer to FAQ
to determine whether to replace it with .bash_profile
.
FAQ
nvm command not found (command not found)
Environment variables need to be configured manually.
Execute the command echo $SHELL
, and judge the written file according to the result:
- /bin/zsh => zsh => .zshrc
- /bin/bash => bash => .bash_profile
.zshrc
echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.zshrc
source ~/.zshrc
.bash_profile
echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> ~/.bash_profile
source ~/.bash_profile
More
There are still many tools like nvm
which are difficult to install. I have always had the idea of making a series of collections. If you are looking forward to more articles in this regard, please follow me to get the latest news as soon as possible. .
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。