Node.js/npm/源:修订间差异
来自康健生活
| (未显示同一用户的4个中间版本) | |||
| 第34行: | 第34行: | ||
进行分开测试 | 进行分开测试 | ||
{{shc|<syntaxhighlight lang="bash"> | {{shc|<syntaxhighlight lang="bash"> | ||
npm config set @q:registry http://registry.npm.qiwoo.org | npm config set @q:registry http://registry.npm.qiwoo.org \\ | ||
npm install --registry=https://registry.npmmirror.com</syntaxhighlight>|$|/home/kangkk}} | && npm install --registry=https://registry.npmmirror.com</syntaxhighlight>|$|/home/kangkk}} | ||
=== nrm === | === nrm === | ||
| 第57行: | 第57行: | ||
Registry has been set to: https://registry.npm.taobao.org/ | Registry has been set to: https://registry.npm.taobao.org/ | ||
</syntaxhighlight>|kangjian@kangkk:~/github/kangkk.github.io$}} | </syntaxhighlight>|kangjian@kangkk:~/github/kangkk.github.io$}} | ||
添加额外的源,自定义源 | |||
{{Shc_out|<syntaxhighlight lang="bash"> | {{Shc_out|<syntaxhighlight lang="bash"> | ||
nrm add company http://registry.npm.qiwoo.org</syntaxhighlight>|<syntaxhighlight lang="bash"> | nrm add company http://registry.npm.qiwoo.org</syntaxhighlight>|<syntaxhighlight lang="bash"> | ||
add registry company success | |||
</syntaxhighlight>|$|/home/kangkk}} | |||
==== 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"> | |||
</syntaxhighlight>|$|/home/kangkk}} | # 查看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}} | |||
== .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>}} | |||
2025年7月18日 (五) 19:59的最新版本
标题文本
源地址
工具
registry
[jian@kang /home/kangkk]$
npm config get registry
http://registry.npm.qiwoo.org/
设置 registry。
/home/kangkk
# npm config set @myco:registry http://reg.example.com
npm config set registry https://registry.npm.taobao.org
进行分开测试
/home/kangkk
npm config set @q:registry http://registry.npm.qiwoo.org \\
&& npm install --registry=https://registry.npmmirror.com
nrm
npm i -g nrm
kangjian@kangkk:~/github/kangkk.github.io$
nrm ls
* npm -------- https://registry.npmjs.org/
yarn ------- https://registry.yarnpkg.com/
cnpm ------- http://r.cnpmjs.org/
taobao ----- https://registry.npm.taobao.org/
nj --------- https://registry.nodejitsu.com/
npmMirror -- https://skimdb.npmjs.com/registry/
edunpm ----- http://registry.enpmjs.org/
kangjian@kangkk:~/github/kangkk.github.io$
nrm use taobao
Registry has been set to: https://registry.npm.taobao.org/
添加额外的源,自定义源
[jian@kang /home/kangkk]$
nrm add company http://registry.npm.qiwoo.org
add registry company success
mirror-config-china
/home/kangkk
npm i -g mirror-config-china --registry=https://registry.npmmirror.com
/home/kangkk
# 查看npm配置
npm config list
# 查看环境变量
source ~/.bashrc && env
为项目生成镜像配置文件
/home/kangkk
mirror-config-china --registry=https://registry.npmmirror.com
.npmrc
.npmrc
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
根据域设置单独源
.npmrc
registry=https://registry.nlark.com/
@q:registry=http://registry.npm.qiwoo.org
No categories