Skip to content

Latest commit

 

History

History
50 lines (32 loc) · 1.24 KB

set-an-npm-registry-for-packages.md

File metadata and controls

50 lines (32 loc) · 1.24 KB

Set An NPM Registry For Packages

Category: Nodejs

You can configure npm or yarn to resolve package dependencies from a specific registry, for example, one running locally within a corporate network. This approach can be used for React, Angular, or other projects which use npm or yarn.

Scenarios where you may benefit from a registry other than the default at https://registry.npmjs.org/:

  • You have limited internet connectivity
  • Build time performance will be reduced
  • Security policies necessitate it
  • Caching locally will reduce internet traffic

Show the current registry

npm config get registry

Output:

https://registry.npmjs.org/

Set registry globally at the command line

To set a registry globally from the command line, enter the following command:

npm config set registry https://orbiks.com/some-npm-registry/

Set registry for a specific project

Create a file called .npmrc in your project root directory and add the following:

https://orbiks.com/some-npm-registry/

Optionally, log into your registry

You may need to perform a one-off authentication with your registry.

Login to npm, entering your account credentials when prompted:

npm login