Node版本管理控制器

最近項目切換頻繁,經常需要用到node版本的切換,現在總結一下Node的版本管理控制器的使用和安裝

1、Node 可以用n來管理版本的切換
安裝:

npm install -g n

查看幫助:

➜  ~ n --help

Usage: n [options] [COMMAND] [args]

Commands:

  n                              Display downloaded node versions and install selection
  n latest                       Install the latest node release (downloading if necessary)
  n lts                          Install the latest LTS node release (downloading if necessary)
  n <version>                    Install node <version> (downloading if necessary)
  n run <version> [args ...]     Execute downloaded node <version> with [args ...]
  n which <version>              Output path for downloaded node <version>
  n exec <vers> <cmd> [args...]  Execute command with modified PATH, so downloaded node <version> and npm first
  n rm <version ...>             Remove the given downloaded version(s)
  n prune                        Remove all downloaded versions except the installed version
  n --latest                     Output the latest node version available
  n --lts                        Output the latest LTS node version available
  n ls                           Output downloaded versions
  n ls-remote [version]          Output matching versions available for download
  n uninstall                    Remove the installed node and npm

Options:

  -V, --version   Output version of n
  -h, --help      Display help information
  -q, --quiet     Disable curl output (if available)
  -d, --download  Download only
  -a, --arch      Override system architecture
  --all           ls-remote displays all matches instead of last 20
  --insecure      Turn off certificate checking for https requests (may be needed from behind a proxy server)

Aliases:

  which: bin
  run: use, as
  ls: list
  lsr: ls-remote
  rm: -
  lts: stable
  latest: current

Versions:

  Numeric version numbers can be complete or incomplete, with an optional leading 'v'.
  Versions can also be specified by label, or codename,
  and other downloadable releases by <remote-folder>/<version>

    4.9.1, 8, v6.1    Numeric versions
    lts               Newest Long Term Support official release
    latest, current   Newest official release
    boron, carbon     Codenames for release streams
    and nightly, chakracore-release/latest, rc/10 et al

查看已安裝的Node版本(我本地只有兩個版本):

➜  ~ n ls
node/9.10.1
node/12.10.0

安裝不同的版本:

➜  ~ n 9.10.0

安裝最新版本:

➜  ~ n latest

安裝穩定版本:

➜  ~ n stable

刪除某個版本:

➜  ~ n rm 9.10.1

**2、node的版本控制器nvm **

NVM官網:https://github.com/nvm-sh/nvm
下載地址:https://github.com/coreybutler/nvm-windows/releases

進入網址後下載nvm-setup.zip,點擊安裝nvm-setup.exe。

查看版本:

 nvm -v 

安裝你想要的node的版本:

nvm install  9.10.1

安裝穩定版:

nvm stable

安裝最新版:

 nvm latest

查看目前安裝的node的版本有哪些:

nvm use *.*.*
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章