Node.js/npm/代理:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第17行: 第17行:
{{shc|<syntaxhighlight lang="bash">
{{shc|<syntaxhighlight lang="bash">
yarn config list | grep 'proxy'</syntaxhighlight>|$|/home/kwy}}
yarn config list | grep 'proxy'</syntaxhighlight>|$|/home/kwy}}
设置代理
{{shc|<syntaxhighlight lang="bash">
yarn config set proxy http://192.168.51.34:808 \
&& yarn config set https-proxy http://192.168.51.34:808</syntaxhighlight>|$|/home/kwy}}
删除代理
{{shc|<syntaxhighlight lang="bash">
yarn config delete proxy \
&& yarn config delete https-proxy</syntaxhighlight>|$|/home/kwy}}

2025年7月29日 (二) 15:11的版本

npm

查看代理

[jian@kang /home/kangkk]$
npm config get proxy
null
 
npm config set proxy http://127.0.0.1:1080
npm i node-sass

# 下载完成后删除 http 代理
npm config delete proxy

yarn

查看代理配置

/home/kwy
yarn config list | grep 'proxy'

设置代理

/home/kwy
yarn config set proxy http://192.168.51.34:808 \
&& yarn config set https-proxy http://192.168.51.34:808

删除代理

/home/kwy
yarn config delete proxy \
&& yarn config delete https-proxy