When publishing a npm package, npm will use your configuration sources for a destination registry. npm also provides an ability to override configuration via the publishConfig field in package.json.

If your package is non-scoped, then you can override the publish npm registry:

JSON
{
  "publishConfig": {
    "registry": "https://npm.joegornick.com"
  }
}
Click to expand and view more

However, if your package is scoped , then there’s an undocumented ability to override the publish npm registry by prefixing registry with the @scope:

JSON
{
  "publishConfig": {
    "@foo:registry": "https://npm.foo.com"
  }
}
Click to expand and view more

References

No way to override registry in .npmrc for scoped packages w/–registry flag

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut