Static deploy fails with private npm modules

This works on Netlify by setting the NPM_TOKEN environment variable, but that doesn’t seem to help here. Is there something I’m missing maybe?

Hi David,

Currently, we don’t have native support for private npm packages. In the root of your project do you have a .npmrc file with the line //registry.npmjs.org/:_authToken=${NPM_TOKEN} ? I have not tested if this will work on Render but it is listed in the npm docs along with setting that environment variable. If that doesn’t work, some users have been able to install those packages directly from git by including a private git token in their build commands.

That did the trick. This was a bit confusing as I thought the suggestion was to commit a file with the actual token value (which I did not want to do). npm is happy to have an environment variable name in this file and interpolate the value itself. Thanks!

Hi, is there any plan to support private npm packages? I’m a bit concerned having my npm token out in the open like that

Right before I yarn install, I create the file on the fly and use an environment variable in render with my token. Simple enough imo.

1 Like

Hmm i didn’t think about this, will it it a try thanks!

1 Like