雪之梦技术驿站
  • Summary
  • Tips
  • 运维部署
    • docker-advance
    • docker + Bark
    • docker + blog
    • docker compose
    • docker + crawlab
    • docker + email
    • docker 环境
    • docker + gitbook
    • docker + gitea
    • docker + gitlab
    • docker + gogs
    • docker + mojo-Weixin
    • docker + mysql
    • docker + nginx
    • docker 操作
    • docker + py12306
    • docker + redis
    • docker + resume
    • docker + springboot
    • docker + wechat-work-message-push-go
  • git
    • git 入门教程
    • base
      • 初识 git
      • 配置 git
      • 安装 git
  • github
    • github 入门教程
  • 晚安
  • markdown
    • README_update
  • todo
    • github 快速入门
    • android studio 快速入门
    • gitignore 快速入门
    • gulp快速入门
    • java 快速入门
    • lodash快速入门
    • maven 快速入门
    • mysql 快速入门
    • nginx 快速入门
    • npm 快速入门
    • nvm快速入门
    • regexper快速入门
    • sublime快速入门
    • svn 快速入门
    • tomcat 快速入门
    • yarn快速入门
  • write
    • 快速上手Mermaid流程图
  • gitbook
    • gitbook-plugin-advanced-emoji
      • LICENSE-IMAGES
      • LICENSE
Powered by GitBook
On this page
  • 下载并配置
  • 基本用法
  • npm 镜像
  • fad
  • 参考资料

Was this helpful?

  1. todo

nvm快速入门

Previousnpm 快速入门Nextregexper快速入门

Last updated 9 months ago

Was this helpful?

下载并配置

  • 下载安装脚本并运行

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
  • NVM配置国内镜像

export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
  • 刷新环境变量

source ~/.bash_profile
  • 检测是否安装成功

command -v nvm
  • 升级 nvm

(
  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"

基本用法

  • 下载最新版本

nvm install node
  • 下载指定版本

nvm install 8
  • 列出全部远程可用版本

nvm ls-remote

nvm ls available

  • 使用最新版本

nvm use node
  • 使用指定版本

nvm use 8
  • 列出已安装版本

nvm ls

npm 镜像

  • 临时使用

npm install gitbook -g --registry https://registry.npm.taobao.org
  • 永久使用

npm config set registry https://registry.npm.taobao.org
  • 恢复使用

npm config set registry https://registry.npmjs.org
  • 当前镜像

npm config get registry

fad

  • nvm is not compatible with the npm config "prefix" option: currently set to ""

参考资料

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
使用 nvm 管理不同版本的 node 与 npm
nvm使用taobao镜像
npm太慢, 淘宝npm镜像使用方法
解决 nvm is not compatible with the npm config "prefix"