Skip to content

Instantly share code, notes, and snippets.

@biilmann
Created October 14, 2015 22:07
Show Gist options
  • Save biilmann/0b2250095eedc188d0c9 to your computer and use it in GitHub Desktop.
Save biilmann/0b2250095eedc188d0c9 to your computer and use it in GitHub Desktop.
Quick Guide to Private NPM Modules on Netlify

Using NPM Private Modules on Netlify

Create a .npmrc file for your project like this:

//registry.npmjs.org/:_authToken=${NPM_TOKEN}

Then find your token inside the ~/.npmrc file in your home folder and set it as an NPM_TOKEN environment variable through netlify's admin UI.

@bsdahl
Copy link

bsdahl commented Mar 8, 2019

How do you make this work in the local dev environment?

$ yarn
yarn install v1.13.0
error An unexpected error occurred: "Failed to replace env in config: ${NPM_TOKEN}".

@glennvgastel
Copy link

glennvgastel commented Mar 11, 2019

You set the env variable first.
Either inline : NPM_TOKEN=xxxxxxxxxx yarn
Or by setting it up for your system.

@brianzelip
Copy link

brianzelip commented Mar 31, 2019

EDIT

See this thread on the npm forum about configuring w/ env vars.

@nathanbirrell
Copy link

@snandigam2
Copy link

The private packages located in GitHub under one project, I have 10-15 small Modules now,

my npmrc look like this

@organization:registry=https://npm.pkg.github.com

I don't have a token setup here, How to make it work in my scenario

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