I'm testing a new version of our npm packages registry. I'd like to run a job in our CI server specifying a registry different of the default.
I tried to execute npm publish --registry "http://nexus.dsv.myhost/nexus/repository/npmjs-registry
but it didn't work. It was published to the default registry.
How do I specify a different registry while running npm publish
. It is a scoped package.
Publishes a package to the registry so that it can be installed by name. By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a scope in the name, combined with a scope-configured registry (see package. json ).
There's multiple ways to accomplish this.
use npm config
to set the registry globally:
npm config set registry http://nexus.dsv.myhost/nexus/repository/npmjs
use npm config
to set the registry for the package scope:
npm config set @<your scope here>:registry http://nexus.dsv.myhost/nexus/repository/npmjs
configure your package.json with a publish config:
{
...
"publishConfig": {
"registry": "http://nexus.dsv.myhost/nexus/repository/npmjs"
},
...
}
use npmrc
to configure the registry
registry=http://nexus.dsv.myhost/nexus/repository/npmjs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With