Yahwe Raj
Yahwe Raj

Reputation: 2057

How to override npm project config?

I have a nodejs project and placed .npmrc file at root to override default npm config. I need to change the npm project config while building the project. Is there any option available to override the npm project config?

I tried to run this

npm config set registry "https://registry.npmjs.org/"

but it couldn't override the npm project config.

Upvotes: 5

Views: 7330

Answers (2)

AZRckCrwler
AZRckCrwler

Reputation: 462

I realize this is very old. However, I believe that the project specific .npmrc file overwrites your global .npmrc file, not the global overwriting the project as you seemed to mention in your question.

From my research, it appears that there is no project-specific argument for the npm config set command. It only works on the global file, I think...

I found success by just running all the npm config set <key> <value> commands I needed, going to my global .npmrc file and copying all the new key/value pairs, pasting those into my project specific .npmrc file, then going back and deleting those new key/values from my global .npmrc file.

Upvotes: 1

Thennarasan
Thennarasan

Reputation: 718

To override use --registry

sample format npm --registry registryurl install packagename

Upvotes: 2

Related Questions