Windows下NodeJS npm配置

Windows下的Nodejs npm默认路径是appdata, 通过npm config命令更改

npm config set cache "D:\nodejs\node_cache"
npm config set prefix "D:\nodejs\node_global"

或者在nodejs的安装目录中找到node_modules\npm.npmrc文件'
修改如下即可:
prefix = D:\nodejs\node_global
cache = D:\nodejs\node_global
registry=https://registry.npm.taobao.org

淘宝 NPM 镜像
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
或者编辑.npmrc
registry=https://registry.npm.taobao.org

推荐使用nrm

$ npm install -g nrm
$ 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
    skimdb -- https://skimdb.npmjs.com/registry

$ nrm use cnpm

你可能感兴趣的:(Windows下NodeJS npm配置)