安装配置node环境


1.nvm去github上找到Windows版本下载,这里下载nvm-noinstall,然后解压

2.点击install.cmd会看到弹出一个settings.txt,把当前路径(就是nvm-noinstall解压的路径,建议C:\Develop\nvm-noinstall)复制进去敲回车 

3.做如下配置并保存(注意360之类的软件以及防火墙都关闭)

root: C:\Develop\nvm-noinstall 
path: C:\Develop\nodejs 
arch: 64 
proxy: none

4.环境配置

配置用户变量--路径是控制面板->系统和安全->系统->高级系统设置->环境变量

注意不要改变系统变量

在用户变量里新建变量名

    变量名  NVM_HOME        变量值  C:\Develop\nvm-noinstall

    变量名  NVM_SYMLINK    变量值  C:\Develop\nodejs

psth里面添加如下

%NVM_HOME%;%NVM_SYMLINK%

5.测试

在任意目录下打开命令工具,输入如下
    

 nvm -v


如果执行结果如下则配置完成

Running version 1.1.2.

    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.

 

 

6.下载nodejs,命令行输入

    nvm install <版本号>

    例如下载7.6.0版本:nvm install 7.6.0

 


 

配置npm

配置用户变量--路径是控制面板->系统和安全->系统->高级系统设置->环境变量

注意不要改变系统变量

在用户变量里新建变量名

变量名  NPM_HOME       变量值  C:\Users\Administrator\node_modules\.bin

psth里面添加如下

  

%NPM_Home%;C:\Users\Administrator\AppData\Roaming\npm

命令行输入一下命令测试

npm -v

结果为

C:\Users\G>npm -v
4.1.2

npm淘宝镜像cnpm

下载命令行输入 如下代码

npm install -g cnpm --registry=https://registry.npm.taobao.org

下载完成输入如下代码测试

cnpm -v

显示如下安装成功

cnpm@4.5.0 (C:\Develop\nvm-noinstall\v7.6.0\node_modules\cnpm\parse_argv.js)
npm@3.10.10 (C:\Develop\nvm-noinstall\v7.6.0\node_modules\cnpm\node_modules\npm\lib\npm.js)
node@7.6.0 (C:\Develop\nodejs\node.exe)
npminstall@2.24.0 (C:\Develop\nvm-noinstall\v7.6.0\node_modules\cnpm\node_modules\npminstall\lib\index.js)
prefix=C:\Develop\nodejs
win32 x64 10.0.14393
registry=https://registry.npm.taobao.org

转载于:https://www.cnblogs.com/izgl/p/6433105.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值