VUE npm 代理 配置

方式一

cmd命令中设置

set http_proxy=http://IP:PORT
set https_proxy=http://IP:PORT
set http_proxy_user=XXXX
set http_proxy_pass=123454321

方式二

配置代理

npm config set http-proxy "http://username:%21%40%23%245678@ip:port"
npm config set https-proxy "http://username:%21%40%23%245678@ip:port"

密码中特殊字符参考

https://www.cyberciti.biz/faq/unix-linux-export-variable-http_proxy-with-special-characters/

 

 

//统一保存module
npm config set cache "C:\work\nodejs\node_cache"
npm config set prefix "C:\work\nodejs\node_global_modules"

cnpm config set cache "C:\work\nodejs\node_cache"
cnpm config set prefix "C:\work\nodejs\node_global_modules"

 

 


npm root -g #查询配置

npm install -g cnpm --registry=https://registry.npm.taobao.org
npm config set registry https://registry.npm.taobao.org
npm config set registry https://registry.npmjs.org/ 原:https://registry.npmjs.org/
npm config get registry

npm install -g @vue/cli
cnpm install -g @vue/cli

 

发生Python错误

管理员身份打开cmd
npm install -g node-gyp
npm install --global --production windows-build-tools
npm uninstall node-sass
npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/

 

 

//npm配置文件

C:\Users\xxx\.npmrc

posted @ 2020-09-07 17:09  闻见知行  阅读(597)  评论(0编辑  收藏  举报