MAC NVM Configuration

Source: Internet
Author: User
Tags aliases

1. Introduction of NVM
    • The NVM (Node version Manager) is a tool that allows you to install and switch different versions of node on the same machine.

    • GitHub Address

2. NVM Environment Configuration 2.1 Install NVM
    • If the system does not have Git installed, you need to install Git first.

    • Install the NVM by entering the following command in the terminal.

      # 安装 NVM$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
    • After the installation is complete, enter the following command in the terminal to configure the environment variables.

      # 打开环境变量配置文件$ vim ~/.bash_profile
    • Add a field to the. bash_profile file.

      source ~/.bashrc
    • Save the file to exit and enter the following command in the terminal to make the configuration effective.

      # 使环境变量配置生效$ source ~/.bash_profile
2.2 NVM Common commands
  • Common commands

      # to see which version of the system is already installed, this command can also see which version is currently being used $ NVM ls# list all the version numbers that can be installed $ NVM ls-remote# installation of the specified version $ NVM install [version]$ NVM Inst All v10.2.0# switch to the specified version, the toggle effect is global for NVM use [version]$ NVM uses v10.2.0# view currently used version $ NVM current  
    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 C Olorized output should respect the '--no-colors ' option. USAGE:NVM--help Show This message nvm--version Print out T He installed version of NVM NVM install [-S] <version> Download and install a <version>, [-S] From source.  Uses. NVMRC if available--reinstall-packages-from=<version> when installing, reinstall packages installed in <node|iojs|node version number>--lts When installing, only select from LTS (l  Ong-term support) Versions--lts=<lts name> if 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 NVM uninstall <version> Uninstall a version nvm uninstall--lts U  Ninstall 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 [--silent] <version> Modify PATH to use <version>. Uses. NVMRC if available--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 [--silent] <version> [<command>] Run <command> on <version>. Uses. NVMRC IfAvailable--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 [--silent] <version> [<args>] Run ' node ' on <version> with <args> as arguments. Uses. NVMRC if available--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 Display currently activated version NVM LS L IST installed versions NVM LS <version> List versions matching a given <version> NV                                   M ls-remote List remote versions available for install--lts When listing, only show LTS (long-term suPport) versions NVM ls-remote <version> List remote versions available for install, matching a GI    Ven <version>--lts when listing, only show LTS (long-term support) versions --lts=<lts name> when listing, only show versions for a specific LTS line NVM version <v               Ersion> Resolve The given description to a single local version NVM Version-remote <version> Resolve the given description to a single remote version--lts when LIS Ting, only select from LTS (long-term support) versions--lts=<lts name> when listing, onl  Y Select from versions to a specific LTS line NVM deactivate Undo effects of ' nvm ' on current Shell NVM alias [<pattern>] Show all aliases beginning with <pattern> NVM alias <nam   E> <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 containe D in <version> to current version nvm unload unload "NVM" from Shell nvm which [cur Rent | <version>] Display path to installed node version.  Uses. NVMRC if available nvm cache dir Display path to the cache directory for NVM NVM cache Clear Empty Cache directory for NVMEXAMPLE:NVM install 8.0.0 install a SP                  Ecific 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 nod E version on a shell NVM alias default node all default to the latest available node version on a shell note:to Remove, delete, or uninstall Nvm-just remove the ' $NVM _dir ' folder (usually ' ~/.NVM ')

Mac NVM Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.