package fails for private npm modules

Open
#415 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, nodejs
Domain
cli

Research direction

Start at the node-lambda package command and trace how it launches the container and runs npm install --production. Determine how the NPM_TOKEN environment variable can reach that process, then verify that packaging succeeds for a package.json containing private npm modules.

Written by the indexing model from the issue text.

Description

enhancement question

Packaging with:

node-lambda package ...

will fail when package.json contains modules that are private on npm. I found a solution was to make a .npmrc file, put the following contents in it, and .gitignore it.

//registry.npmjs.org/:_authToken=00000000-0000-0000-0000-000000000000

However, as suggested on the npm docs, they recommend exporting an environment variable instead from your ~/.profile, or ~/.bashrc...

export NPM_TOKEN="00000000-0000-0000-0000-000000000000"

Then, use a NPM_TOKEN environment variable inside the .npmrc:

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

How does one pass the NPM_TOKEN environment variable into the node-lambda package container so that it can be available when it executes npm install --production?

Dominant language
JavaScript
Stars
1.4k
Forks
185
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from motdotla/node-lambda

All issues in motdotla/node-lambda

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.