How to deploy to Elastic Beanstalk using the CLI when you have Private NPM Packages?

Viewed 279

We use several namespaced private packages through NPM.

When we attempt to deploy as we always have using the EB CLI (eb deploy) everything is fine until EB attempts to run npm i. This causes the deployment to fail as EB does not have access to our NPM Organization's Packages.

I found related questions from 4+ years ago with solutions that do not seem to work.

We've resorted to the workaround of manually 'zipping' the files locally and uploading it in the GUI.

How can we allow our Elastic Beanstalk Instances to deploy with our private packages via the eb deploy command?

1 Answers

The npm docs cover it well. The problem is, for some reason the environment variable, NPM_TOKEN isn't read and it fails. We fixed by hardcoding a read-only, IP whitelisted token into the .npmrc file.

Related