For most projects I pull packages from the internal server, so it's been added by
yarn config set registry http://custom-packages-server.com
But now in the new project I'd like to use the different (default) one, but use it in that particular project only. As far as I understood if I run the following command inside of new project's directory
yarn config set registry https://registry.yarnpkg.com
it's going to update global registry value for all other projects as well, so they also will be looking for packages in the new place.
So is there a possibility in yarn to override global registry record for a specific project only?
It's usually https://registry.npmjs.org/ , but it's configurable.
Yarn can consume the same package. json format as npm, and can install any package from the npm registry. This will lay out your node_modules folder using Yarn's resolution algorithm that is compatible with the node.
Yarnrc files (named this way because they must be called . yarnrc. yml ) are the one place where you'll be able to configure Yarn's internal settings. While Yarn will automatically find them in the parent directories, they should usually be kept at the root of your project (often your repository).
Found the way how to achieve that.
It turned out that you can use .yarnrc file inside the project's directory (yeah, pretty much the same like .npmrc
). And there you can specify custom config properties which yarn will look into first.
So that's how my .yarnrc file looks now.
registry "https://registry.yarnpkg.com"
It is also possible to temporarily override the registry for one yarn
command, without having to modify a file:
yarn --registry=https://registry.company.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With