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.
There's multiple ways to accomplish this.
1) use npm config
to set the registry globally:
npm config set registry http://nexus.dsv.myhost/nexus/repository/npmjs
2) 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
3) configure your package.json with a publish config:
{
...
"publishConfig": {
"registry": "http://nexus.dsv.myhost/nexus/repository/npmjs"
},
...
}
4) use npmrc
to configure the registry
registry=http://nexus.dsv.myhost/nexus/repository/npmjs