Home > Web Front-end > JS Tutorial > body text

How to use nvm tool to manage node version? Method introduction

青灯夜游
Release: 2020-12-08 17:46:03
forward
3020 people have browsed it

How to use nvm tool to manage node version? Method introduction

Related recommendations: "node js tutorial"

nvm is a popular way to run Node.js. For example, it makes it easy to switch Node.js versions, as well as install a new version to try out and easily roll back if something goes wrong.

This is useful for testing code with older versions of Node.js.

1. Install nvm

Execute brew install nvm, then the report:

How to use nvm tool to manage node version? Method introduction

Error 1: Need to create an nvm The file is used to load the content of nvm
//在命令行执行:
mkdir ~/.nvm
Copy after login
Error 2: You need to add the following blue selected configuration to the ~/.zshrc file
//用vim打开该文件
vim ~/.zshrc 

//按i进入书写模式 把蓝色内容黏贴在下方
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion"

//按esc键 :wq保存退出

//此时再次执行brew install nvm还是如图一的报错。那是配置的.zshrc文件没生效。
//因此要在保存.zshrc文件后,在命令行执行使配置生效:
source ~/.zshrc
Copy after login

Enter nvm again. At this time, nvm has been installed. Yes, as well as its information and commands

How to use nvm tool to manage node version? Method introduction

2. nvm routine operations

How to use nvm tool to manage node version? Method introduction

mark only For reference, corrections and additions are welcome. Thanks

For more programming-related knowledge, please visit: Programming Teaching! !

The above is the detailed content of How to use nvm tool to manage node version? Method introduction. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!