安装配置node环境

说明:该内容从我的博客转移过来(http://www.cnblogs.com/izgl/p/6433105.html)

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  [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  : The version must be a specific version. 
                      nvm use [version] [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. 
                      nvm root [path] : 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. 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

显示如下安装成功

  [email protected] (C:\Develop\nvm-noinstall\v7.6.0\node_modules\cnpm\parse_argv.js)
  [email protected] (C:\Develop\nvm-noinstall\v7.6.0\node_modules\cnpm\node_modules\npm\lib\npm.js)
  [email protected] (C:\Develop\nodejs\node.exe)
  [email protected] (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

你可能感兴趣的:(安装配置node环境)