If you use Private npm registry and that npm registry is added to your global .npmrc file, then you probably faced this issue.
So, on the global .npmrc file, there is one entry like
registry=https://myprivatenpmregistry/npm/
Let's say, you wanted to add emotion to the project.
yarn add emotion
Then you probably see the error-
An unexpected error occurred: "https://myprivatenpmregistry/npm/emotion: connect ECONNREFUSED IP:PORTโ.
We can fix this issue easily by adding .npmrc file inside the root directly of the project. Then It will not use the global npm registry and will use the project level .npmrc file.
Inside the .npmrc file we will add -
registry=https://registry.npmjs.org/
๐ฅ
That's the small trick we can do to make it work.
If I have multiple projects with different npm registry then we can add that particular registry to the project level .npmrc and voila ๐
Cheers!
๐
As I am trying to contribute contents on the Web, you can buy me a coffee for my hours spent on all of these โค๏ธ๐๐ธ

My Blog: https://shahjada.me
Top comments (0)