• 使用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

  • 相关阅读:
    解决This application failed to start because it could not find or load the Qt platform plugin "windows
    计算几何-凸包-toleft test
    Bit Operation妙解算法题
    带线表格据gt生成无线表格
    caffe的python接口提取resnet101某层特征
    camelot工具进行pdf表格解析重建
    python批量爬取文档
    IP被封检测地址
    驱动人生后门清除方案
    应用安全
  • 原文地址:https://www.cnblogs.com/io_oti/p/9350653.html
Copyright © 2020-2023  润新知