npm

npm

Config

Proxy

npm -g config set proxy http://127.0.0.1:1080
npm -g config set https-proxy http://127.0.0.1:1080

Using cnpm

# Will automatically store your config to ~/.npmrc
#  registry=https://registry.npm.taobao.org
npm config set registry https://registry.npm.taobao.org

#Manually install package from registry
npm i --registry=https://registry.npm.taobao.org

注意:如果用 npm config 设置过了全局 cnpm 的 registry 后, npm login / npm publish 无法正常工作。需要恢复为官方 registry:

npm config set registry https://registry.npmjs.org/

Full Taobao Mirror

npm set registry https://registry.npm.taobao.org \
&& yarn config set registry https://registry.npm.taobao.org \
&& npm set disturl https://npm.taobao.org/dist \
&& npm set chromedriver_cdnurl http://cdn.npm.taobao.org/dist/chromedriver \
&& npm set operadriver_cdnurl http://cdn.npm.taobao.org/dist/operadriver \
&& npm set phantomjs_cdnurl http://cdn.npm.taobao.org/dist/phantomjs \
&& npm set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents \
&& npm set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass \
&& npm set electron_mirror http://cdn.npm.taobao.org/dist/electron/

Check license

npx license-checker --summary
npx license-compatibility-checker

Alternatives

yarn

yarn config set proxy http://127.0.0.1:1080
yarn config set https-proxy http://127.0.0.1:1080

Last update: 2021-11-01 09:12:32 UTC