赞
踩
下载地址 : https://nodejs.org/zh-cn/download/
如果有nvm先卸载nvm再安装node
菜鸟教程 : 使用 nvm 管理不同版本的 node 与 npm
nvm全名node.js version management,顾名思义是一个nodejs的版本管理工具。
通过它可以安装和切换不同版本的nodejs。下面列出下载、安装及使用方法。
可在点此在github上下载最新版本,本次下载安装的是windows版本。打开网址我们可以看到有两个版本:
ablexq:~ tmk$ nvm Node Version Manager (v0.37.0) Note: <version> refers to any version-like string nvm understands. This includes: - full or partial version numbers, starting with an optional "v" (0.10, v0.1.2, v1) - default (built-in) aliases: node, stable, unstable, iojs, system - custom aliases you define with `nvm alias foo` Any options that produce colorized output should respect the `--no-colors` option. Usage: nvm --help Show this message nvm --version Print out the installed version of nvm nvm install [<version>] 下载并安装<version>. Uses .nvmrc if available and version is omitted. The following optional arguments, if provided, must appear directly after `nvm install`: -s Skip binary download, install from source only. --reinstall-packages-from=<version> When installing, reinstall packages installed in <node|iojs|node version number> --lts When installing, only select from LTS (long-term support) versions --lts=<LTS name> When installing, only select from versions for a specific LTS line --skip-default-packages When installing, skip the default-packages file if it exists --latest-npm After installing, attempt to upgrade to the latest working npm on the given node version --no-progress Disable the progress bar on any downloads --alias=<name> After installing, set the alias specified to the version specified. (same as: nvm alias <name> <version>) --default After installing, set default alias to the version specified. (same as: nvm alias default <version>) nvm uninstall <version> 卸载版本 nvm uninstall --lts Uninstall using automatic LTS (long-term support) alias `lts/*`, if available. nvm uninstall --lts=<LTS name> Uninstall using automatic alias for provided LTS line, if available. nvm use [<version>] 修改PATH以使用<version>. Uses .nvmrc if available and version is omitted. The following optional arguments, if provided, must appear directly after `nvm use`: --silent Silences stdout/stderr output --lts Uses automatic LTS (long-term support) alias `lts/*`, if available. --lts=<LTS name> Uses automatic alias for provided LTS line, if available. nvm exec [<version>] [<command>] Run <command> on <version>. Uses .nvmrc if available and version is omitted. The following optional arguments, if provided, must appear directly after `nvm exec`: --silent Silences stdout/stderr output --lts Uses automatic LTS (long-term support) alias `lts/*`, if available. --lts=<LTS name> Uses automatic alias for provided LTS line, if available. nvm run [<version>] [<args>] Run `node` on <version> with <args> as arguments. Uses .nvmrc if available and version is omitted. The following optional arguments, if provided, must appear directly after `nvm run`: --silent Silences stdout/stderr output --lts Uses automatic LTS (long-term support) alias `lts/*`, if available. --lts=<LTS name> Uses automatic alias for provided LTS line, if available. nvm current 显示节点的当前激活版本 nvm ls [<version>] 列出已安装的版本, matching a given <version> if provided --no-colors Suppress colored output --no-alias Suppress `nvm alias` output nvm ls-remote [<version>] 列出可用于安装的远程版本, matching a given <version> if provided --lts When listing, only show LTS (long-term support) versions --lts=<LTS name> When listing, only show versions for a specific LTS line --no-colors Suppress colored output nvm version <version> 将给定的描述解析为单个本地版本 nvm version-remote <version> 将给定的描述解析为单个远程版本 --lts When listing, only select from LTS (long-term support) versions --lts=<LTS name> When listing, only select from versions for a specific LTS line nvm deactivate Undo effects of `nvm` on current shell --silent Silences stdout/stderr output nvm alias [<pattern>] Show all aliases beginning with <pattern> --no-colors Suppress colored output nvm alias <name> <version> Set an alias named <name> pointing to <version> nvm unalias <name> Deletes the alias named <name> nvm install-latest-npm Attempt to upgrade to the latest working `npm` on the current node version nvm reinstall-packages <version> Reinstall global `npm` packages contained in <version> to current version nvm unload Unload `nvm` from shell nvm which [current | <version>] 显示已安装节点版本的路径. Uses .nvmrc if available and version is omitted. --silent Silences stdout/stderr output when a version is omitted nvm cache dir 显示nvm缓存目录的路径 nvm cache clear nvm的空缓存目录 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 Note: to remove, delete, or uninstall nvm - just remove the `$NVM_DIR` folder (usually `~/.nvm`)
nvm list [available]
#
nvm ls
nvm install 11.13.0
nvm use 11.13.0
nvm uninstall 11.13.0
# 卸载
ablexq:~ tmk$ brew uninstall nvm
Uninstalling /usr/local/Cellar/nvm/0.35.0... (7 files, 146.4KB)
# 安装
ablexq:~ tmk$ brew install nvm
==> Downloading https://github.com/creationix/nvm/archive/v0.37.0.tar.gz
Already downloaded: /Users/tmk/Library/Caches/Homebrew/downloads/6751302114cd390789c662ca013466778ef0ee197b7c98be9411ea4f28562b06--nvm-0.37.0.tar.gz
==> Caveats
Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
problems against the standard nvm install method prior to reporting.
You should create NVM's working directory if it doesn't exist:
mkdir ~/.nvm
Add the following to /Users/tmk/.bash_profile or your desired shell
configuration file:
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.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
You can set $NVM_DIR to any location, but leaving it unchanged from
/usr/local/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.
Type `nvm help` for further information.
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/729403
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。