Yarn: how config yarn use chinese taobao npm mirror

Created on 8 Jan 2017  ·  8Comments  ·  Source: yarnpkg/yarn

i'm from china ,For some reason i use foreign mirror is not good . i can config yarn use chinese taobao's npm mirror ?

needs-discussion

Most helpful comment

Yes, you can do this! You can run

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

This will set it in npm's configuration (.npmrc file in your home directory), and Yarn will reuse this same configuration. Every time you install an npm package, it will come from Taobao's mirror 😃

All 8 comments

Yes, you can do this! You can run

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

This will set it in npm's configuration (.npmrc file in your home directory), and Yarn will reuse this same configuration. Every time you install an npm package, it will come from Taobao's mirror 😃

thanks,It works great!

@Daniel15 What about @types/<package> packages.

After setup the Chinese mirror, I still get

error An unexpected error occurred: "https://registry.yarnpkg.com/@types/ws/-/ws-0.0.41.tgz: ETIMEDOUT".
yarn --version
0.27.5

@Daniel15 Never mind, fixed by remove yarn.lock

try:
yarn config set registry 'https://registry.npm.taobao.org'

how do you revert the changes?

@jjhesk you can run this command

npm config delete registry
# or
yarn config delete registry

Or delete registry key manually in ~/.npmrc or ~/.yarnrc file.

  • npm install -g yrm
  • yrm ls

    • yarn use taobao

    • yrm test taobao

Was this page helpful?
0 / 5 - 0 ratings