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

devDependencies of git dependency are missing during prepare when installing with --prod in main package #2920

Closed
RomanH2 opened this issue Mar 23, 2021 · 1 comment
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@RomanH2
Copy link

RomanH2 commented Mar 23, 2021

Current Behavior:

Dev dependencies of git dependency are missing during prepare in npm v7 (npm v6 works fine) when the main package dependencies are installed using the --prod flag.

Expected Behavior:

If the package being installed contains a prepare script, its dependencies and devDependencies will be installed, and the prepare script will be run, before the package is packaged and installed.

Steps To Reproduce:

Package 1 (main):

{
  "name": "main-package",
  "version": "0.0.0",
  "scripts": {},
  "dependencies": {
    "git-dep": "git+ssh://git@github.com:<user>/<repo>.git"
  },
  "devDependencies": {
    "typescript": "^4.2.3"
  }
}

Package 2 (git dependency):

{
  "name": "git-dep",
  "version": "0.0.0",
  "scripts": {
    "prepare": "npm run build",
    "build": "tsc -b --verbose tsconfig.build.json"
  },
  "dependencies": {},
  "devDependencies": {
    "typescript": "^4.2.3"
  }
}

Run npm ci or npm i in main package with prod flag, npm ci --prod:

npm ERR! > git-dep@0.0.0 prepare
npm ERR! > npm run build
npm ERR! 
npm ERR! 
npm ERR! > git-dep@0.0.0 build
npm ERR! > tsc -b --verbose tsconfig.build.json
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! sh: 1: tsc: not found
npm ERR! npm ERR! code 127
npm ERR! npm ERR! path /home/XXXX/.npm/_cacache/tmp/git-clone-XXXXXXX
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c tsc -b --verbose tsconfig.build.json
npm ERR! 
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     /home/XXXX/.npm/_logs/XXXXXXXXXXXXXXXX-debug.log
npm ERR! npm ERR! code 127
npm ERR! npm ERR! path /home/XXXX/.npm/_cacache/tmp/git-clone-XXXXX
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh -c npm run build

npm ERR! sh: 1: tsc: not found ==> tsc should not be missing, as it should come with the typescript devDependency of the git-dep

Seems to be similar to #1865

Environment:

  • OS: Ubuntu 18.04
  • Node: 15.8.0
  • npm: 7.6.3
@RomanH2 RomanH2 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 23, 2021
@darcyclarke darcyclarke removed the Needs Triage needs review for next steps label May 14, 2021
@darcyclarke darcyclarke added the Priority 1 high priority issue label May 14, 2021
@isaacs
Copy link
Contributor

isaacs commented Jun 18, 2021

Will be closed when npm/pacote#81 lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

3 participants