Node.js/npm/源:修订间差异
来自康健生活
| 第63行: | 第63行: | ||
add registry company success | add registry company success | ||
</syntaxhighlight>|$|/home/kangkk}} | </syntaxhighlight>|$|/home/kangkk}} | ||
== .npmrc == | |||
{{hc|.npmrc|<syntaxhighlight lang="text"> | |||
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ | |||
phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/ | |||
electron_mirror=https://npm.taobao.org/mirrors/electron/ | |||
registry=https://registry.npm.taobao.org</syntaxhighlight>}} | |||
根据域设置单独源 | |||
{{hc|head=.npmrc|output=<syntaxhighlight lang="text"> | |||
registry=https://registry.nlark.com/ | |||
@q:registry=http://registry.npm.qiwoo.org</syntaxhighlight>}} | |||
=== 源工具 === | |||
==== mirror-config-china ==== | |||
{{shc|<syntaxhighlight lang="bash"> | |||
npm i -g mirror-config-china --registry=https://registry.npmmirror.com</syntaxhighlight>|$|/home/kangkk}} | |||
{{shc|<syntaxhighlight lang="bash"> | |||
# 查看npm配置 | |||
npm config list | |||
# 查看环境变量 | |||
source ~/.bashrc && env</syntaxhighlight>|$|/home/kangkk}} | |||
为项目生成镜像配置文件 | |||
{{shc|<syntaxhighlight lang="bash"> | |||
mirror-config-china --registry=https://registry.npmmirror.com</syntaxhighlight>|$|/home/kangkk}} | |||