Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

confused about .yarnrc and .npmrc

I have a private npm registry and a .npmrc file in the root directory of my project like this

_auth=${NPM_TOKEN}
always-auth=true
[email protected]
registry=https://example.com/artifactory/api/npm/

But I use yarn install to install the packages. Now, I am confused.

Should I create a .yarnrc file? If so, how can I convert .npmrc above to .yarnrc? Didn't find configurations such as _auth, always-auth in https://classic.yarnpkg.com/en/docs/yarnrc/

yarn installs packages from https://registry.yarnpkg.com, npm installs packages from https://registry.npmjs.org/. They have different registries. I am not sure yarn can installs packages from my private npm registry and obey the configurations of .npmrc.

I am going to use yarn. Should I build a private yarn registry?

like image 556
slideshowp2 Avatar asked Mar 31 '20 08:03

slideshowp2


People also ask

Why do we need .npmrc file?

npmrc is the configuration file that npm allows to be used globally or user level or project level to optimize your npm environment.

Where does the .npmrc file go?

npmrc Files Per-project config file: /path/to/my/project/. npmrc. Per-user config file: ~/. npmrc.

Which is better Yarn or npm?

As previously stated, Yarn installs dependency packages in parallel, whereas NPM installs them sequentially. As a result, Yarn outperforms NPM when installing bigger files. Both tools can save dependent files to the offline cache.


1 Answers

I ran into the same issue. I just created .yarnrc file in the root folder of my project with the following content and it worked.

registry "<artifactory-url>"
like image 168
Vipul Goyal Avatar answered Oct 17 '22 04:10

Vipul Goyal