Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vnys/7da9521fc2f259100d588a4f43189a43 to your computer and use it in GitHub Desktop.
Save vnys/7da9521fc2f259100d588a4f43189a43 to your computer and use it in GitHub Desktop.
How to: Equinor private NPM registry

How to: Equinor private NPM registry

Disclamer: This is just an example on how to do these tasks. You can configure npm/yarn in many ways to make life easier.
Feel free to experiment.

Login

CLI

Requirements: Have a Github account that is a member of the Github organization Equinor

  1. Create a personal access token on Github with the read:org scope
  2. Run npm login --registry https://npm.equinor.com
    Username: {Your Github username}
    Password: {The personal access token}
    Email: {Whichever you prefer}

Web

You can browse the registry on https://npm.equinor.com. Use you Github username, and the access token as password.

Install

To install a package from this registry;
npm install @equinor-internal/myPrivatePackage --registry https://npm.equinor.com

Publish

Private

To publish a private package, set the scope of the package to @equinor-internal.
So the name of the package becomes; @equinor-internal/myPrivatePackage
NB! Packages with no scope, OR a different scope, are readable by the world.

Public

You can also publish a public package to this registry.
Simply ommit the "@equinor-internal" scope.
You have to login with a valid Equinor account to publish, but they can be accessed by everyone.

Tips and Tricks

  • You can set the default registry with;
    npm set registry https://npm.equinor.com
    The registry acts as a proxy, so requests for packages not in this registry will be forwarded to registry.npmjs.org
  • You can browse the registry on https://npm.equinor.com. Use you Github username, and the access token as password.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment