zoukankan      html  css  js  c++  java
  • nvm版本管理工具安装

    windows 安装nvm步骤(shi'yongnvm-windows管理node版本):

    瞎几把前言:mac上可以用n来管理node版本,私以为n很好用。家里的win7台式机一直没有安装过任何管理工具,今天来给家里电脑安装一下nvw-windows,一个用于windows系统的node版本工具。

    电脑系统:系统win7 64位:

    nvw-windows的官网:https://github.com/coreybutler/nvm-windows/releases

    一、安装步骤:
    (一)下载:
    首先从官网下载安装包 https://github.com/coreybutler/nvm-windows/releases,我下了一个setup版本的,下下来是个压缩包,解压后里面是一个exe,安装方式就如同一个常见的exe安装包,双击运行即可:

    (一)安装:
    1.双击exe开始安装:

    2.下面这一步:配置nvm的安装位置,任意一个你喜欢的位置都可以。

    3.设置node的symlink文件夹位置。这个文件夹的名字一定不能含有中文或空格!

    4.如果在安装nvm之前,电脑上就已经安装有node的,会看到如下图,询问你是否用nvm管理已经存在的node版本。一定要选‘是’,这个弹窗可能会出现好几次,都点是。

    5.安装完成。看到如下图:

    (二)使用nvm:
    1.检查nvm是否安装成功:
    使用管理员权限打开一个命令行。输入nvm v,会显示nvm的版本号,有则表示安装成功。

    1. nvm各命令用法:(黏自官网)
      nvm arch [32|64]: Show if node is running in 32 or 64 bit mode. Specify 32 or 64 to override the default architecture.
      nvm install [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.
      nvm list [available]: List the node.js installations. Type available at the end to show a list of versions available for download.
      nvm on: Enable node.js version management.
      nvm off: Disable node.js version management (does not uninstall anything).
      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 uninstall : Uninstall a specific version.
      nvm use [arch]: Switch to use the specified version. Optionally specify 32/64bit architecture. nvm use will continue using the selected version, but switch to 32/64 bit mode based on the value supplied to . For information about using use in a specific directory (or using .nvmrc), please refer to issue #16.
      nvm root : Set the directory where nvm should store different versions of node.js. If is not set, the current root will be displayed.
      nvm version: Displays the current running version of NVM for Windows.
      nvm node_mirror <node_mirror_url>: Set the node mirror.People in China can use https://npm.taobao.org/mirrors/node/
      nvm npm_mirror <npm_mirror_url>: Set the npm mirror.People in China can use https://npm.taobao.org/mirrors/npm/

    2. nvm常用命令(个人对上述命令中的常用命令的一个总结和翻译):
      安装指定版本的node: nvm install 版本号
          比如安装8.9.3:

    nvm install 8.9.3
    使用指定版本的node: nvm use 版本号
        比如使用8.9.3:

    nvm use 8.9.3
    使用淘宝node镜像:nvm node_mirror
    nvm node_mirror https://npm.taobao.org/mirrors/node/
    使用淘宝npm镜像:nvm npm_mirror
    nvm npm_mirror https://npm.taobao.org/mirrors/npm/
    查看当前电脑上已经安装的全部node版本,正在使用中的版本号前有个星号:
    nvm ls
    查看可用的(可下载的)全部node版本:
    nvm ls available
    二、NVM使用中常见错误:
    (一)、nvm use 出现exit status 1

    使用补充:

    一个nodejs的安装使用流程:

    nvm ls // 查看目前已经安装的版本
    nvm install 6.10.0 // 安装指定的版本的nodejs
    nvm use 6.10.0 // 使用指定版本的nodejs
    这是我安装第一个版本时候的命令:

    图6:这是我安装第一个版本时候的命令

    认真看以下的图,相同的nvm ls命令,得到的结果为什么不一样?因为,这是使用了nvm切换到了指定的版本。如果在nvm ls命令输出了 当前样式,说明切换成功了。如果没有出现(Currently using 64-bit executable),则表示没有切换成功。这就需要查看原因,认真按照上面步骤来。
    图7:nvm ls展示已经安装的nodejs版本

    使用命令时注意点
    请用管理员身份运行命令管理器,否则可能出错。
    先设置node和npm的淘宝镜像,这样成功率和下载速度会更高点。
    用途
    1:主要用途,切换nodejs版本。如果想使用最新的流行版本测试您正在开发的模块,而不用卸载稳定版本的node,则可以使用nvm来切换nodejs版本。

    注意点
    nvm安装目录,最好不要存在空格。否则,nvm可以安装成功,但使用nvm use x.y.z(nodejs的切换)会有问题。
    有些全局的npm模块,可能在各版本的node.js之间不共享。
    你正在使用的node.js版本中可能不支持某些npm模块。因此在工作的时候请注意工作环境。
    更多内容请查看:
    出处:http://www.cnblogs.com/weiqinl
    个人主页http://weiqinl.com
    github: weiqinl
    简书:weiqinl

  • 相关阅读:
    Struts系列教材 (四)- 基础
    Struts系列教材 (三)- 基础
    Struts系列教材 (一)- 基础
    Hibernate系列教材 (三十)- 注解
    网络之AFNetworking
    iOS网络学习之“远离NSURLConnection 走进NSURLSession”
    ios中常见数据存储方式以及SQLite常用的语句
    利用"仿射变换"制作“酷炫特效”
    图片滚动新闻和新闻的滚动菜单
    简易聊天窗口
  • 原文地址:https://www.cnblogs.com/xiaocongcong888/p/9384989.html
Copyright © 2011-2022 走看看