Member-only story

Bypass your global npm registry for individual repo

Shahjada Talukdar
2 min readOct 29, 2019

--

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

--

--

Shahjada Talukdar
Shahjada Talukdar

Written by Shahjada Talukdar

Senior Software Engineer @eBay. Tech enthusiast, loves JS + few other languages. Keen to learn about Software Engineering/Architecture.

No responses yet

Write a response