gradle-node-plugin icon indicating copy to clipboard operation
gradle-node-plugin copied to clipboard

Support custom registry from project .npmrc in NpmSetupTask

Open Vampire opened this issue 3 years ago • 4 comments

The NpmSetupTask does not obey to the custom registry defined in .npmrc file of the project. An ~/.npmrc does work, but it would be nice if the custom registry defined in the project specific .npmrc would als be used for NpmSetupTask. Workaround is to use args to configure a custom registry.

Vampire avatar May 14 '22 20:05 Vampire

I just had a similar case. You could also use args to configure the .npmrc file you want to use. Like this:

tasks.named("npmSetup") {
    args.addAll(['--userconfig', "${project.projectDir}/.npmrc"])
}

christianblos avatar May 15 '24 12:05 christianblos

But then you would not have the normal user config considered. Besides that you can then right away use the args to configure the custom repository if you need to configure anyway. :-)

Vampire avatar May 15 '24 12:05 Vampire

I just wanted to mention this solution as an alternative. I'm using a custom registry together with the _auth config. So, I needed to include the whole .npmrc file instead of just adding --registry. But you're right, it would be nice if the project file would be used automatically.

christianblos avatar May 15 '24 16:05 christianblos