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 doesn't install local dependencies in v7 #2968

Open
mikeharder opened this issue Mar 25, 2021 · 0 comments
Open

[BUG] npm install -g doesn't install local dependencies in v7 #2968

mikeharder opened this issue Mar 25, 2021 · 0 comments
Labels
cmd:install related to `npm install` Documentation documentation related issue Needs Discussion is pending a discussion Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release Release 8.x work is associated with a specific npm 8 release

Comments

@mikeharder
Copy link

mikeharder commented Mar 25, 2021

Current Behavior:

npm install -g does not install local dependencies as part of the global install. This appears to be a breaking change between v6 and v7.

Expected Behavior:

npm install -g does install local dependencies

Steps To Reproduce:

  1. Create a directory containing a package.json with a dependency:
{
  "name": "test",
  "version": "1.0.0",
  "dependencies": {
    "typescript": "^4.2.3"
  }
}
  1. In this directory, run npm install -g.

npm v6

# npm install -g
+ test@1.0.0
added 2 packages from 1 contributor in 1.83s

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

npm v7

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

# npm ls -g --depth 1
`-- test@1.0.0 -> /app
  `-- UNMET DEPENDENCY typescript@^4.2.3
  
# ls
package.json

Workaround

Running a local npm install in the directory (before or after the global install) fixes the issue.

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
@darcyclarke darcyclarke added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels May 14, 2021
@ruyadorno ruyadorno added Needs Discussion is pending a discussion pr: needs documentation pull request requires docs before merging Release 8.x work is associated with a specific npm 8 release cmd:install related to `npm install` and removed Bug thing that needs fixing labels Apr 4, 2022
@lukekarrys lukekarrys added Documentation documentation related issue and removed pr: needs documentation pull request requires docs before merging labels Apr 10, 2022
jkuester added a commit to jkuester/cht-upgrade-helper that referenced this issue Mar 8, 2023
This avoids a bug in newer versions of NPM when globally installing local sources:
npm/cli#2968
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd:install related to `npm install` Documentation documentation related issue Needs Discussion is pending a discussion Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

4 participants