npm / npm/cli

${npm_config_local_prefix} in project .npmrc

Open
#6,008 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

https://github.com/npm/cli/blob/c52cf6bc547268833cde2715fe4f6299240049f8/workspaces/config/lib/index.js#L600

I see that the local prefix is loaded before the project-specific .npmrc file is loaded. So would it be possible to make ${npm_config_local_prefix} an environment variable that can be used in .npmrc?

Example use case for this in .npmrc:

node-options=--require ${npm_config_local_prefix}/project/path/to/module.js

Contributor guide

Open the contributing guide

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.

Research direction

Start at workspaces/config/lib/index.js around line 600 and trace how the local prefix and project .npmrc are loaded. Investigate whether npm_config_local_prefix can be made available during .npmrc expansion, using the issue's node-options example as the expected behavior; done means the variable resolves correctly in a project .npmrc.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.