~~手动调整 mirror-config-china 镜像指向,taobao.org域名将停用~~

=== add at 2022.04.20 ===

  • mirror-config-china 改为 npmmirror-config-china
npm i -g npmmirror-config-china --registry=https://registry.npmmirror.com
# 查看npm配置
npm config list
# 查看环境变量
source ~/.bashrc && env

.

.

=== old , 不要再往下阅读了,下面内容已不适用 ===

看到新闻,npm.taobao.org 将在2022年5月停用
有错误的地方希望网友们帮忙指正

下面是我电脑上的,镜像调整,前后对比

  • 下面是 npm config list 的输出结果:
D:\repo_yarn>npm config list
; "user" config from C:\Users\51372\.npmrc

cache = "D:\\repo_npm\\npm_cache"
chromedriver_cdnurl = "https://mirrors.huaweicloud.com/chromedriver"
chromedriver-cdnurl = "https://npm.taobao.org/mirrors/chromedriver"
couchbase-binary-host-mirror = "https://npm.taobao.org/mirrors/couchbase/v{version}"
debug-binary-host-mirror = "https://npm.taobao.org/mirrors/node-inspector"
disturl = "https://npm.taobao.org/dist"
electron_mirror = "https://npm.taobao.org/mirrors/electron/"
electron-mirror = "https://npm.taobao.org/mirrors/electron/"
flow-bin-binary-host-mirror = "https://npm.taobao.org/mirrors/flow/v"
fse-binary-host-mirror = "https://npm.taobao.org/mirrors/fsevents"
fuse-bindings-binary-host-mirror = "https://npm.taobao.org/mirrors/fuse-bindings/v{version}"
git4win-mirror = "https://npm.taobao.org/mirrors/git-for-windows"
gl-binary-host-mirror = "https://npm.taobao.org/mirrors/gl/v{version}"
grpc-node-binary-host-mirror = "https://npm.taobao.org/mirrors"
hackrf-binary-host-mirror = "https://npm.taobao.org/mirrors/hackrf/v{version}"
leveldown-binary-host-mirror = "https://npm.taobao.org/mirrors/leveldown/v{version}"
leveldown-hyper-binary-host-mirror = "https://npm.taobao.org/mirrors/leveldown-hyper/v{version}"
mknod-binary-host-mirror = "https://npm.taobao.org/mirrors/mknod/v{version}"
node-sqlite3-binary-host-mirror = "https://npm.taobao.org/mirrors"
node-tk5-binary-host-mirror = "https://npm.taobao.org/mirrors/node-tk5/v{version}"
nodegit-binary-host-mirror = "https://npm.taobao.org/mirrors/nodegit/v{version}/"
operadriver_cdnurl = "https://mirrors.huaweicloud.com/operadriver"
operadriver-cdnurl = "https://npm.taobao.org/mirrors/operadriver"
phantomjs_cdnurl = "https://mirrors.huaweicloud.com/phantomjs"
phantomjs-cdnurl = "https://npm.taobao.org/mirrors/phantomjs"
prefix = "D:\\repo_npm\\npm_global"
profiler-binary-host-mirror = "https://npm.taobao.org/mirrors/node-inspector/"
puppeteer-download-host = "https://npm.taobao.org/mirrors"
python_mirror = "https://repo.huaweicloud.com/python"
python-mirror = "https://npm.taobao.org/mirrors/python"
rabin-binary-host-mirror = "https://npm.taobao.org/mirrors/rabin/v{version}"
registry = "https://registry.npm.taobao.org/"
sass_binary_site = "https://mirrors.huaweicloud.com/node-sass"
sass-binary-site = "https://npm.taobao.org/mirrors/node-sass"
sodium-prebuilt-binary-host-mirror = "https://npm.taobao.org/mirrors/sodium-prebuilt/v{version}"
sqlite3-binary-site = "https://npm.taobao.org/mirrors/sqlite3"
store-dir = "D:/repo_npm/.pnpm-store"
utf-8-validate-binary-host-mirror = "https://npm.taobao.org/mirrors/utf-8-validate/v{version}"
utp-native-binary-host-mirror = "https://npm.taobao.org/mirrors/utp-native/v{version}"
zmq-prebuilt-binary-host-mirror = "https://npm.taobao.org/mirrors/zmq-prebuilt/v{version}"
  • 下面是 yarn config list 的输出结果
D:\repo_yarn>yarn config list
yarn config v1.22.10
warning package.json: No license field
info yarn config
{
  'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-commit-hooks': true,
  'version-git-sign': false,
  'version-git-message': 'v%s',
  'init-version': '1.0.0',
  'init-license': 'MIT',
  'save-prefix': '^',
  'bin-links': true,
  'ignore-scripts': false,
  'ignore-optional': false,
  registry: 'https://registry.npm.taobao.org/',
  'strict-ssl': true,
  'user-agent': 'yarn/1.22.10 npm/? node/v14.15.4 win32 x64',
  'cache-folder': 'D:\\repo_yarn\\cache',
  'global-folder': 'D:\\repo_yarn\\global',
  lastUpdateCheck: 1644491119453,
  prefix: 'D:\\repo_yarn\\global'
}
info npm config
{
  prefix: 'D:\\repo_npm\\npm_global',
  cache: 'D:\\repo_npm\\npm_cache',
  sass_binary_site: 'https://mirrors.huaweicloud.com/node-sass',
  phantomjs_cdnurl: 'https://mirrors.huaweicloud.com/phantomjs',
  chromedriver_cdnurl: 'https://mirrors.huaweicloud.com/chromedriver',
  operadriver_cdnurl: 'https://mirrors.huaweicloud.com/operadriver',
  python_mirror: 'https://repo.huaweicloud.com/python',
  'store-dir': 'D:/repo_npm/.pnpm-store',
  electron_mirror: 'https://npm.taobao.org/mirrors/electron/',
  registry: 'https://registry.npm.taobao.org',
  disturl: 'https://npm.taobao.org/dist',
  'chromedriver-cdnurl': 'https://npm.taobao.org/mirrors/chromedriver',
  'couchbase-binary-host-mirror': 'https://npm.taobao.org/mirrors/couchbase/v{version}',
  'debug-binary-host-mirror': 'https://npm.taobao.org/mirrors/node-inspector',
  'electron-mirror': 'https://npm.taobao.org/mirrors/electron/',
  'flow-bin-binary-host-mirror': 'https://npm.taobao.org/mirrors/flow/v',
  'fse-binary-host-mirror': 'https://npm.taobao.org/mirrors/fsevents',
  'fuse-bindings-binary-host-mirror': 'https://npm.taobao.org/mirrors/fuse-bindings/v{version}',
  'git4win-mirror': 'https://npm.taobao.org/mirrors/git-for-windows',
  'gl-binary-host-mirror': 'https://npm.taobao.org/mirrors/gl/v{version}',
  'grpc-node-binary-host-mirror': 'https://npm.taobao.org/mirrors',
  'hackrf-binary-host-mirror': 'https://npm.taobao.org/mirrors/hackrf/v{version}',
  'leveldown-binary-host-mirror': 'https://npm.taobao.org/mirrors/leveldown/v{version}',
  'leveldown-hyper-binary-host-mirror': 'https://npm.taobao.org/mirrors/leveldown-hyper/v{version}',
  'mknod-binary-host-mirror': 'https://npm.taobao.org/mirrors/mknod/v{version}',
  'node-sqlite3-binary-host-mirror': 'https://npm.taobao.org/mirrors',
  'node-tk5-binary-host-mirror': 'https://npm.taobao.org/mirrors/node-tk5/v{version}',
  'nodegit-binary-host-mirror': 'https://npm.taobao.org/mirrors/nodegit/v{version}/',
  'operadriver-cdnurl': 'https://npm.taobao.org/mirrors/operadriver',
  'phantomjs-cdnurl': 'https://npm.taobao.org/mirrors/phantomjs',
  'profiler-binary-host-mirror': 'https://npm.taobao.org/mirrors/node-inspector/',
  'puppeteer-download-host': 'https://npm.taobao.org/mirrors',
  'python-mirror': 'https://npm.taobao.org/mirrors/python',
  'rabin-binary-host-mirror': 'https://npm.taobao.org/mirrors/rabin/v{version}',
  'sass-binary-site': 'https://npm.taobao.org/mirrors/node-sass',
  'sodium-prebuilt-binary-host-mirror': 'https://npm.taobao.org/mirrors/sodium-prebuilt/v{version}',
  'sqlite3-binary-site': 'https://npm.taobao.org/mirrors/sqlite3',
  'utf-8-validate-binary-host-mirror': 'https://npm.taobao.org/mirrors/utf-8-validate/v{version}',
  'utp-native-binary-host-mirror': 'https://npm.taobao.org/mirrors/utp-native/v{version}',
  'zmq-prebuilt-binary-host-mirror': 'https://npm.taobao.org/mirrors/zmq-prebuilt/v{version}'
}
Done in 0.11s.

以下是 mirror-config-china github主页 https://github.com/gucong3000/mirror-config-china/blob/master/README.md 上的描述:

{bin-mirrors}
{apt-mirrors}
{ali-mirrors}



--registry=https://registry.npm.taobao.org
registry.npmjs.com 镜像URL

--bin-mirrors-prefix=https://npm.taobao.org/mirrors
npm.taobao.org/mirrors 镜像URL,会覆盖下文中的{bin-mirrors}

--apt-mirrors-prefix=https://mirrors.tuna.tsinghua.edu.cn
mirrors.tuna.tsinghua.edu.cn 镜像URL,会覆盖下文中的{apt-mirrors}

--ali-mirrors-prefix=https://mirrors.aliyun.com
mirrors.aliyun.com 镜像URL,会覆盖下文中的{ali-mirrors} 
阿里云ECS VPC或经典网络用户请分别使用http://mirrors.cloud.aliyuncs.com或http://mirrors.aliyuncs.com代替

--nodejs-org-mirror={bin-mirrors}/node (别名: --disturl)
nodejs.org/dist 镜像URL

--iojs-org-mirror={bin-mirrors}/iojs
iojs.org/dist 镜像URL

--nvmw-npm-mirror={bin-mirrors}/npm
github.com/npm/npm/releases 镜像URL

--apt-mirror={ali-mirrors}
Debian/Ubuntu APT镜像URL

--apt-gitlab-runner={apt-mirrors}/gitlab-runner/{release-id}
GitLab Runner APT镜像URL

--apt-docker-ce={ali-mirrors}/docker-ce/linux/{release-id}
Docker社区版 APT镜像URL

--apt-gitlab-ce={apt-mirrors}/gitlab-ce/{release-id}
GitLab社区版 APT镜像URL

--apt-virtualbox={apt-mirrors}/virtualbox/apt
VirtualBox APT镜像URL

--apt-nodesource={apt-mirrors}/nodesource/deb
NodeJS APT镜像URL前缀


现在时间(2022年2月18日 18:23:27),在使用 yarn 时出现

Done in 0.14s.
info There appears to be trouble with your network connection. Retrying...
  • 使用 yarn config get registry 输出如下信息:
D:\repos_vue_ssr\ssr-demo>yarn config get registry
warning ..\..\package.json: No license field
https://registry.npm.taobao.org/
  • warning ..\..\package.json: No license field 可能是外层目录有 package.json 文件,或者根目录下有 package.json 文件,将其删除即可!

  • 使用下面命令改为新的域名

yarn config set registry https://registry.npmmirror.com
  • 但是,切换过并不能改变 info There appears to be trouble with your network connection. Retrying... 的输出…… (这是什么原因,还得继续寻找 把所有的带 taobao.org 前缀的指向都修改为新的npmmirror.com指向后,就没有再出现了)

  • 列出一个完整的切换命令

yarn config set registry https://registry.npmmirror.com
npm config set registry https://registry.npmmirror.com

yarn config get registry
npm config get registry

yarn global remove mirror-config-china
npm uninstall mirror-config-china -g

npm i -g mirror-config-china --registry=https://registry.npmmirror.com --bin-mirrors-prefix=https://npmmirror.com/mirrors

npm i -g mirror-config-china --registry=https://registry.npmmirror.com --bin-mirrors-prefix=https://npmmirror.com/mirrors

yarn global remove mirror-config-china
npm uninstall mirror-config-china -g

npm i -g mirror-config-china --registry=https://registry.npmmirror.com --bin-mirrors-prefix=https://npmmirror.com/mirrors
  • 运行上面三句,特别是最后一句,并不能改变 npm config list 的显示,
  • 还需要删除 C:\Users\51372\.npmrc 文件中的一些内容,然后再全局安装 mirror-config-china
    • 不行,按照上面的方式, C:\Users\51372\.npmrc 文件还是没有变化,仍然是 https://npm.taobao.org 的前缀
  • 看来目前我只能全局替换 C:\Users\51372\.npmrc 这个文件了。【自己手动修改】
E:\wxg\test>npm config list
; "user" config from C:\Users\51372\.npmrc
  • ☀🌙⭐手动替换后的文件内容如下:
  • 有些是有问题的,比如 puppeteer-download-host=https://npmmirror.com/mirrors 这个就找不到
  • 出了问题再调整吧
prefix=D:\repo_npm\npm_global

cache=D:\repo_npm\npm_cache

sass_binary_site=https://mirrors.huaweicloud.com/node-sass

phantomjs_cdnurl=https://mirrors.huaweicloud.com/phantomjs

chromedriver_cdnurl=https://mirrors.huaweicloud.com/chromedriver

operadriver_cdnurl=https://mirrors.huaweicloud.com/operadriver

python_mirror=https://repo.huaweicloud.com/python

store-dir=D:/repo_npm/.pnpm-store

registry=https://registry.npmmirror.com
disturl=https://npmmirror.com/mirrors/node
chromedriver-cdnurl=https://npmmirror.com/mirrors/chromedriver
couchbase-binary-host-mirror=https://npmmirror.com/mirrors/couchbase/v{version}
debug-binary-host-mirror=https://npmmirror.com/mirrors/node-inspector
electron-mirror=https://npmmirror.com/mirrors/electron/
flow-bin-binary-host-mirror=https://npmmirror.com/mirrors/flow/v
fse-binary-host-mirror=https://npmmirror.com/mirrors/fsevents
fuse-bindings-binary-host-mirror=https://npmmirror.com/mirrors/fuse-bindings/v{version}
git4win-mirror=https://npmmirror.com/mirrors/git-for-windows
gl-binary-host-mirror=https://npmmirror.com/mirrors/gl/v{version}
grpc-node-binary-host-mirror=https://npmmirror.com/mirrors
hackrf-binary-host-mirror=https://npmmirror.com/mirrors/hackrf/v{version}
leveldown-binary-host-mirror=https://npmmirror.com/mirrors/leveldown/v{version}
leveldown-hyper-binary-host-mirror=https://npmmirror.com/mirrors/leveldown-hyper/v{version}
mknod-binary-host-mirror=https://npmmirror.com/mirrors/mknod/v{version}
node-sqlite3-binary-host-mirror=https://npmmirror.com/mirrors
node-tk5-binary-host-mirror=https://npmmirror.com/mirrors/node-tk5/v{version}
nodegit-binary-host-mirror=https://npmmirror.com/mirrors/nodegit/v{version}/
operadriver-cdnurl=https://npmmirror.com/mirrors/operadriver
phantomjs-cdnurl=https://npmmirror.com/mirrors/phantomjs
profiler-binary-host-mirror=https://npmmirror.com/mirrors/node-inspector/
puppeteer-download-host=https://npmmirror.com/mirrors
python-mirror=https://npmmirror.com/mirrors/python
rabin-binary-host-mirror=https://npmmirror.com/mirrors/rabin/v{version}
sass-binary-site=https://npmmirror.com/mirrors/node-sass
sodium-prebuilt-binary-host-mirror=https://npmmirror.com/mirrors/sodium-prebuilt/v{version}
sqlite3-binary-site=https://npmmirror.com/mirrors/sqlite3
utf-8-validate-binary-host-mirror=https://npmmirror.com/mirrors/utf-8-validate/v{version}
utp-native-binary-host-mirror=https://npmmirror.com/mirrors/utp-native/v{version}
zmq-prebuilt-binary-host-mirror=https://npmmirror.com/mirrors/zmq-prebuilt/v{version}

End

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,684评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,143评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,214评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,788评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,796评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,665评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,027评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,679评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 41,346评论 1 299
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,664评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,766评论 1 331
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,412评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,015评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,974评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,203评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,073评论 2 350
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,501评论 2 343

推荐阅读更多精彩内容