[nodejs study notes] download and install nodejs, install and use nodejs version management tool nvm

normal download method

download link

Test whether the download is successful

node -v
npm -v

The full name of NPM is Node Package Manager, which is a NodeJS package management and distribution tool, and has become an unofficial standard for releasing Node modules (packages).
npm is the default package manager for Node.js, the JavaScript runtime environment.

NVM method

nvm is a nodejs version management tool that can switch between multiple nodejs versions. If your different projects use different versions of nodejs, it is recommended to use this tool.
Note: Before installing nvm, delete nodejs on the computer to avoid subsequent installation failures.

windows download icon

Use of nvm

nvm -v // 查看当前 nvm 版本

nvm list // 查看已安装的 node 版本列表
nvm ls-remote // 列出所有远程服务器的版本

nvm install 版本号 // 安装指定的 node 版本
nvm install stable // 安装最新稳定版 node
nvm reinstall-packages 版本号 // 在当前版本 node 环境下,重新全局安装指定版本号的 npm 包
nvm uninstall 版本号 // 卸载指定版本

nvm use 版本号 // 切换指定的 node 版本
nvm current // 显示当前的版本
nvm alias 别名 版本号 // 给不同的版本号添加别名
nvm unalias 别名 // 删除已定义的别名
nvm alias default 版本号 // 设置默认版本

nvm on // 开启nvm
nvm off // 关闭nvm

Guess you like

Origin blog.csdn.net/dongkeai/article/details/127505323