Giter Site home page Giter Site logo

nvm's Introduction

Node Version Manager

nvm安装加速教程以及镜像。

本仓库镜像站点:https://gitlab.com/mirrorx/nvm

安装/更新

脚本方式安装(简单)

export NVM_SOURCE=https://gitlab.com/mirrorx/nvm.git
curl -o- https://gitlab.com/mirrorx/nvm/-/raw/master/install.sh | bash
export NVM_SOURCE=https://gitlab.com/mirrorx/nvm.git
wget -qO- https://gitlab.com/mirrorx/nvm/-/raw/master/install.sh | bash

执行上面任一脚本后,脚本会自动把仓库检出到~/.nvm,然后尝试将下面的配置加入到配置文件(~/.bash_profile, ~/.zshrc, ~/.profile, 或 ~/.bashrc)。

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # 加载 nvm

检验安装是否成功

执行以下命令:

command -v nvm

如果结果显示nvm则表示已经安装成功.

Git方式安装

如果已经安装git(v1.7.10+):

  1. 克隆仓库到你的用户目录下
  • cd ~/ 然后执行 git clone https://gitlab.com/mirrorx/nvm.git .nvm
  1. cd ~/.nvm进入目录后切换到 git checkout v0.38.0
  2. 执行. ./nvm.sh激活nvm

最后把下面内容加入到~/.bashrc, ~/.profile, 或 ~/.zshrc文件:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # 加载 nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # 加载 nvm bash_completion

手动安装

export NVM_DIR="$HOME/.nvm" && (
  git clone https://gitlab.com/mirrorx/nvm.git "$NVM_DIR"
  cd "$NVM_DIR"
  git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && \. "$NVM_DIR/nvm.sh"

然后添加下面内容到~/.bashrc, ~/.profile, 或 ~/.zshrc

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # 加载 nvm

手动升级

如果已经安装git(v1.7.10+):

(
  cd "$NVM_DIR"
  git fetch --tags origin
  git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && \. "$NVM_DIR/nvm.sh"

一些操作

设置默认node

nvm alias default node

设置node安装镜像

export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node
nvm install node

NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node nvm install 4.2

nvm's People

Contributors

ineo6 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.