装好了node,但是执行install时一直失败,看了一下日志,是连接超时,这个时候想起来电脑是使用代理上的网;
1.设置代理
npm config set proxy=http://127.0.0.1:8080
npm config set registry=http://registry.npmjs.org12
//https
npm config set https-proxy http://server:8080
- 有用户名和密码的代理
npm config set proxy http://username:password@server:port
npm config set https-proxy http://username:password@server:port
3.取消代理
npm config delete proxy
npm config delete https-proxy
本文详细介绍了如何在使用代理上网的环境下,解决npm install时出现的连接超时问题。通过设置npm的http和https代理,可以有效避免安装依赖时的网络问题。同时,也提供了取消代理设置的方法。
966

被折叠的 条评论
为什么被折叠?



