How to install the npm registry for a specific project only

I use the private npm registry for one of my npm packages, and I also have several other packages referenced by the default npm registry. What I am doing now is:

npm config set registry https://private.registry.endpoint 

However, this is changing the registry around the world. I can manually create .npmrc in the root of my project and manually install the registry. This does not replace my global registry and uses a private registry for a specific project only. However, I want to do this with the command instead of manually creating .npmrc and installing the registry.

In case you are wondering why I need this, I know how to do it myself, but I have to direct other users how to do it, and it would be easier to just give them a command. I need to know if there is a way to do something like this:

 npm config --local set registry https://private.registry.endpoint 
+6
source share
1 answer

We solved this problem by looking at our private packages, which allows us to add a private registry only for a specific @scope instead of changing the default default registry for downloading private packages.

0
source

Source: https://habr.com/ru/post/1013423/


All Articles