Open willson-wang opened 5 years ago
yarn 换源无效
为啥yarn还是从 https://registry.yarnpkg.com/typescript/-/typescript-4.8.3.tgz 下载? @willson-wang
root@e0be6fa9b954:/home/qgb/github/ttyd/html# yarn config set registry https://registry.npm.taobao.org/
yarn config v1.22.5
success Set "registry" to "https://registry.npm.taobao.org/".
Done in 0.15s.
root@e0be6fa9b954:/home/qgb/github/ttyd/html# yarn --verbose
yarn install v1.22.5
verbose 0.436960296 Checking for configuration file "/home/qgb/github/ttyd/html/.npmrc".
verbose 0.439027224 Checking for configuration file "/usr/local/share/.npmrc".
verbose 0.440137082 Checking for configuration file "/usr/local/etc/npmrc".
verbose 0.441650248 Checking for configuration file "/root/.npmrc".
verbose 0.444070318 Checking for configuration file "/home/qgb/github/ttyd/html/.npmrc".
verbose 0.445265517 Checking for configuration file "/home/qgb/github/ttyd/.npmrc".
verbose 0.446985045 Checking for configuration file "/home/qgb/github/.npmrc".
verbose 0.448392982 Checking for configuration file "/home/qgb/.npmrc".
verbose 0.450277538 Checking for configuration file "/home/.npmrc".
verbose 0.453962827 Checking for configuration file "/home/qgb/github/ttyd/html/.yarnrc".
verbose 0.455026517 Checking for configuration file "/usr/local/share/.yarnrc".
verbose 0.45657441 Found configuration file "/usr/local/share/.yarnrc".
verbose 0.45956652 Checking for configuration file "/usr/local/etc/yarnrc".
verbose 0.461709041 Checking for configuration file "/root/.yarnrc".
verbose 0.462653765 Checking for configuration file "/home/qgb/github/ttyd/html/.yarnrc".
verbose 0.463650717 Checking for configuration file "/home/qgb/github/ttyd/.yarnrc".
verbose 0.464644167 Checking for configuration file "/home/qgb/github/.yarnrc".
verbose 0.466554308 Checking for configuration file "/home/qgb/.yarnrc".
verbose 0.467738866 Checking for configuration file "/home/.yarnrc".
verbose 0.495063898 current time: 2022-10-06T15:09:38.800Z
[1/4] Resolving packages...
[2/4] Fetching packages...
verbose 3.467550628 Performing "GET" request to "https://registry.yarnpkg.com/typescript/-/typescript-4.8.3.tgz".
[#############################################################################################################################################################################] 1011/10123
info There appears to be trouble with your network connection. Retrying...
verbose 400.843693345 Performing "GET" request to "https://registry.yarnpkg.com/typescript/-/typescript-4.8.3.tgz".
^C
root@e0be6fa9b954:/home/qgb/github/ttyd/html# yarn config get registry
https://registry.npm.taobao.org/
root@2dcd635ef249:/home/qgb/ngrok-tmux-ttyd# find / -name "*xterm*"
find: '/proc/368/map_files': Permission denied
find: '/proc/373/map_files': Permission denied
/usr/local/share/.cache/yarn/v6/npm-xterm-addon-web-links-0.6.0-0296cb6c99588847894670d998c9ea6a6aeb26ee-integrity
/usr/local/share/.cache/yarn/v6/npm-xterm-addon-web-links-0.6.0-0296cb6c99588847894670d998c9ea6a6aeb26ee-integrity/node_modules/xterm-addon-web-links
/usr/local/share/.cache/yarn/v6/npm-xterm-addon-web-links-0.6.0-0296cb6c99588847894670d998c9ea6a6aeb26ee-integrity/node_modules/xterm-addon-web-links/typings/xterm-addon-web-links.d.ts
/usr/local/share/.cache/yarn/v6/npm-xterm-addon-web-links-0.6.0-0296cb6c99588847894670d998c9ea6a6aeb26ee-integrity/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js
/usr/local/share/.cache/yarn/v6/npm-xterm-addon-web-links-0.6.0-0296cb6c99588847894670d998c9ea6a6aeb26ee-integrity/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js.map
/usr/local/share/.cache/yarn/v6/npm-xterm-addon-fit-0.5.0-2d51b983b786a97dcd6cde805e700c7f913bc596-integrity
yarn.lock
typescript@^4.8.3:
version "4.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.3.tgz#d59344522c4bc464a65a730ac695007fdb66dd88"
integrity sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==
typescript@^4.8.3:
version "4.8.3"
resolved "https://10.***/a%3DN.geta%28%29%3BN.file%28p%2Ca%29%23-/home/qgb/test/typescript-4.8.3.tgz"
integrity sha512-goMHfm00nWPa8UvR/CPSvykqf6dVV8x/dp0c5mFTMTIu0u0FlGWRioyy7Nn0PGAdHxpJZnuO/ut+PpQ8UiHAig==
改了之后,可以用了
npm及yarn源的简单修改
npm
设置单次包下载的源,以淘宝镜像为例
设置全局镜像,以淘宝镜像为例
yarn
设置单次包下载的源,以淘宝镜像为例
设置全局镜像,以淘宝镜像为例
借助第三方工具实现快速切换npm及yarn源
npm借助nrm来实现
安装
列出可选的源,带 * 的是当前使用的源
显示当前的源
切换源
添加源
删除源
测试响应时间
yarn借助yrm来实现 yrm是nrmfork出来的,使用方式与nrm保持一致 区别是使用yrm use 切换源时,会同时切换npm及yarn的源,而nrm则只会切换npm的源 另外nrm与yrm不能共存,先全局装了yrm,然后又全局装了nrm,导致yrm不能使用了
参考链接 https://github.com/Pana/nrm https://github.com/i5ting/yrm