Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm install -g includes devDependencies in v7 #2969

Closed
mikeharder opened this issue Mar 25, 2021 · 1 comment
Closed

[BUG] npm install -g includes devDependencies in v7 #2969

mikeharder opened this issue Mar 25, 2021 · 1 comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release

Comments

@mikeharder
Copy link

Current Behavior:

npm install -g includes devDependencies as part of the global install. This appears to be a breaking change between v6 and v7. Might be related to #2968.

Expected Behavior:

npm install -g does not include devDependencies.

Steps To Reproduce:

  1. Create a directory containing a package.json with both a dependency and a devDependency:
{
  "name": "test",
  "version": "1.0.0",
  "dependencies": {
    "typescript": "^4.2.3"
  },
  "devDependencies": {
    "rimraf": "^3.0.2"
  }
}
  1. Run npm install --prod to install prod dependencies. Required in npm v7 due to [BUG] npm install -g doesn't install local dependencies in v7 #2968.

  2. Run npm install -g.

npm v6

# npm install -g
+ test@1.0.0
added 1 package in 0.073s

# npm ls -g --depth 1
`-- test@1.0.0 -> /app
  `-- typescript@4.2.3

npm v7

# npm install -g
added 1 package, and audited 3 packages in 403ms
found 0 vulnerabilities

# npm ls -g --depth 1
`-- test@1.0.0 -> /app
  +-- UNMET DEPENDENCY rimraf@^3.0.2
  `-- typescript@4.2.3

Environment:

  • OS: Ubuntu 18.04
  • Node: 15.12.0
  • npm: 7.7.5
@mikeharder mikeharder added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Mar 25, 2021
@nlf
Copy link
Contributor

nlf commented Mar 26, 2021

there's no bug here, but i do think the npm ls -g output is maybe a little confusing. unmet dependency is telling you that the package wasn't installed, but that we're aware it's part of a complete package tree. we should potentially be more careful to omit those when doing a global package list since it's intentional for them to not be present.

@nlf nlf closed this as completed Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

2 participants