npm / npm/cli

[BUG] $npm_package_dependencies_* are no longer set in v7

Open
#3,022 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority 2 Release 7.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Current Behavior:

Any $npm_package_dependencies_* variables defined in v6, are no longer set in v7.

Expected Behavior:

$npm_package_dependencies_* variables should list the values from package.json

Steps To Reproduce:
  1. Define a script to list env variables:
  "scripts": {
    "env": "env"
  },
  1. List them:
npm run env | grep -i npm_package | sort
  1. Notice that in v7, several npm_package_* variables are present, but not any of npm_package_dependencies_*
  2. Notice that in v6, all of them are present.
Environment:

OS: Ubuntu 20.10
Node: v15.12.0
npm: 7.8.0

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

No files or tests are named. First reproduce the npm v6 versus v7 behavior with the provided env script and package.json dependency variables; then trace the npm CLI code that constructs script environment variables. Done means dependency-related npm_package_* variables are again populated consistently with package.json and the reproduction output passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
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.