Node.js
Node.js 是一个开源、跨平台的 JavaScript 运行时环境。
nvm
nvm 可以用来管理当前 shell 使用的 Nodejs 版本。
常用命令:
- 查看可安装版本:
nvm ls-remote - 查看已安装版本:
nvm ls - 安装指定版本 Nodejs:
nvm install <version>,比如最新的lts版本:nvm install --lts - 使用指定版本:
nvm use --lts,项目中可以使用 .nvmrc 文件进行版本控制。 - 显示当前使用版本:
nvm current - 在指定版本上运行
command:nvm exec [<version>] [<command>], 如果使用了.nvmrc文件,version参数可以不用指定,比如nvm exec yarn start - Run
nodeonversionwithargsas arguments.nvm run [<version>] [<args>], Uses.nvmrcif available and version is omitted. - 取消当前
shell行的 nvm 效果:nvm deactivate
Example:
nvm install 8.0.0 Install a specific version number
nvm use 8.0 Use the latest available 8.0.x release
nvm run 6.10.3 app.js Run app.js using node 6.10.3
nvm exec 4.8.3 node app.js Run `node app.js` with the PATH pointing to node 4.8.3
nvm alias default 8.1.0 Set default node version on a shell
nvm alias default node Always default to the latest available node version on a shell
nvm install node Install the latest available version
nvm use node Use the latest version
nvm install --lts Install the latest LTS version
nvm use --lts Use the latest LTS version
更多用法参考 使用说明。
fnm
fnm 是一个基于 Rust 的 Node.js 版本管理工具,可用于替换 Node Version Manager(nvm)。相比 nvm 速度更快。


评论