Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Private npm modules in Travis Pro

Log into npm using the account you want to use for accessing the private modules on Travis

$ npm login

Then copy the npm auth token from your ~/.npmrc file. It's the string after "//".

In Travis, add the NPM_TOKEN environment variable to the settings with the token value.

In your .travis.yml file:

language: node_js

  - 4

  - printf "//${NPM_TOKEN}\n" >> .npmrc

This comment has been minimized.

Copy link

jgrund commented Sep 28, 2015

Could also do:

- npm config set // $NPM_TOKEN

In before_install


This comment has been minimized.

Copy link

fyockm commented Sep 30, 2015

Any reason not to simply have an .npmrc file in your project directory with a single line? Why set it before install every time?


This comment has been minimized.

Copy link

paralin commented Aug 11, 2016

@fyockm Security, you don't want tokens in the repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.