zoukankan      html  css  js  c++  java
  • 使用NVM管理Node

    安装 NVM

      NVM 下载:https://github.com/coreybutler/nvm-windows

    安装 Node

    注意:如果没有FQ默认源可能安装npm失败,请参考下一节“安装 NPM”修改镜像源地址。

    • 查看可用版本:
      nvm ls available
    • 安装Node:
      nvm install [version]
    • 指定使用版本:
      nvm use [version]

    安装 NPM

      nvm全称Node Version Manager是 Nodejs 版本管理器,它让我们能方便的对 Nodejs 的版本进行切换。

      使用默认源可能安装npm失败,需要修改../nvm/settings.txt文件,添加如下配置。

      root: C:dev
    vm 
      path: C:dev
    odejs 
      arch: 64 
      proxy: none 
      node_mirror: http://npm.taobao.org/mirrors/node/
      npm_mirror: https://npm.taobao.org/mirrors/npm/

    安装NRM

      nrm(npm registry manager)是npm的镜像源管理工具,有时候国外资源太慢,那么我们可以用这个来切换镜像源。

    • 安装nrm
      npm install nrm -g
    • 查看可用镜像源
      nvm>nrm ls
      
      * npm ---- https://registry.npmjs.org/
        cnpm --- http://r.cnpmjs.org/
        taobao - https://registry.npm.taobao.org/
        nj ----- https://registry.nodejitsu.com/
        rednpm - http://registry.mirror.cqupt.edu.cn/
        npmMirror  https://skimdb.npmjs.com/registry/
        edunpm - http://registry.enpmjs.org/
    • 选择使用镜像源
      nrm use taobao

    NVM 命令

    Usage:
    
      nvm arch                     : Show if node is running in 32 or 64 bit mode.
      nvm install <version> [arch] : The version can be a node.js version or "latest" for the latest stable version.
                                     Optionally specify whether to install the 32 or 64 bit version (defaults to system arch).
                                     Set [arch] to "all" to install 32 AND 64 bit versions.
                                     Add --insecure to the end of this command to bypass SSL validation of the remote download server.
      nvm list [available]         : List the node.js installations. Type "available" at the end to see what can be installed. Aliased as ls.
      nvm on                       : Enable node.js version management.
      nvm off                      : Disable node.js version management.
      nvm proxy [url]              : Set a proxy to use for downloads. Leave [url] blank to see the current proxy.
                                     Set [url] to "none" to remove the proxy.
      nvm node_mirror [url]        : Set the node mirror. Defaults to https://nodejs.org/dist/. Leave [url] blank to use default url.
      nvm npm_mirror [url]         : Set the npm mirror. Defaults to https://github.com/npm/npm/archive/. Leave [url] blank to default url.
      nvm uninstall <version>      : The version must be a specific version.
      nvm use [version] [arch]     : Switch to use the specified version. Optionally specify 32/64bit architecture.
                                     nvm use <arch> will continue using the selected version, but switch to 32/64 bit mode.
      nvm root [path]              : Set the directory where nvm should store different versions of node.js.
                                     If <path> is not set, the current root will be displayed.
      nvm version                  : Displays the current running version of nvm for Windows. Aliased as v.

    参考链接

    https://www.runoob.com/w3cnote/nvm-manager-node-versions.html

    https://blog.csdn.net/qq_27626333/article/details/77857223

  • 相关阅读:
    大数据技术学习之Spark技术总结
    PS教程之利用像素化来制作一个乐高积木的创意海报
    Java教程之SpringMVC的请求和响应
    GCC中 -I、-L、-l 选项的作用
    给阿里云主机添加swap分区,解决问题:c++: internal compiler error: Killed (program cc1plus)
    使用 C++11 编写可复用多线程任务池
    Go语言学习-函数
    Goland安装与配置
    Go语言学习-基础知识
    VSCode配置Go插件和第三方拓展包
  • 原文地址:https://www.cnblogs.com/io_oti/p/9350653.html
Copyright © 2011-2022 走看看