Skip to content

Instantly share code, notes, and snippets.

@giannif
Last active November 10, 2017 17:18
Show Gist options
  • Save giannif/85a775f9f1e78d85b7e51e3efc727b26 to your computer and use it in GitHub Desktop.
Save giannif/85a775f9f1e78d85b7e51e3efc727b26 to your computer and use it in GitHub Desktop.

To use private modules in your project

Generate an auth token for your .npmrc

Use npm login

  • remove your existing ~/.npmrc, since it won't override
  • npm login
  • copy to project directory
  • never logout npm logout clears your token everywhere

Use generate-npm-token

Resulting npmrc looks like so: //registry.npmjs.org/:_authToken=[your auth token]

To use yarn locally

  • create .yarnc file

Resulting .yarnrc looks like so:

registry "https://registry.npmjs.org/"

Travis worked without the .yarnrc file, somehow

Instead of sharing a token, you can add users in npm, but each user needs to have private modules

To use that token in Travis

travis encrypt --add deploy.api_key [your auth token]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment