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 7 confusing error when installing git dependency with invalid commit-ish #1781

Closed
Coridyn opened this issue Sep 9, 2020 · 1 comment
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@Coridyn
Copy link

Coridyn commented Sep 9, 2020

Current Behavior:

Attempting to install a git dependency with an invalid commit-ish gives a very confusing error that doesn't explain the cause of the problem.

npm@7 should give an error that indicates it can't find a commit with that hash.

npm@6 does give a useful error for this same scenario.

Steps To Reproduce:

package.json

{
  "dependencies": {
    "bad-commitish": "git@github.com:npm/json-parse-even-better-errors.git#bad-commitish"
  }
}

npm 7

$ npm --version
7.0.0-beta.10

$ npm install
npm ERR! code 128
npm ERR! command failed
npm ERR! command git clone --mirror -q ssh://git@github.com/npm/json-parse-even-better-errors.git /home/coridyn/.npm/_cacache/tmp/git-clone-65ca3462/.git
npm ERR! fatal: destination path '/home/coridyn/.npm/_cacache/tmp/git-clone-65ca3462/.git' already exists and is not an empty directory.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/coridyn/.npm/_logs/2020-09-09T08_07_35_128Z-debug.log

npm 6

npm 6 shows a better message for the same scenario

$ npm --version
6.14.8

$ npm install
npm ERR! code 1
npm ERR! Command failed: git checkout bad-commitish
npm ERR! error: pathspec 'bad-commitish' did not match any file(s) known to git.
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/coridyn/.npm/_logs/2020-09-09T08_06_45_815Z-debug.log

Environment:

This occurs in both Windows and Linux npm 7.0.0-beta.10.

$ node --version
v12.16.2

$ npm --version
7.0.0-beta.10
@Coridyn Coridyn 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 Sep 9, 2020
@darcyclarke darcyclarke removed the Needs Triage needs review for next steps label Oct 1, 2020
@darcyclarke darcyclarke added this to the OSS - Sprint 16 milestone Oct 1, 2020
@darcyclarke darcyclarke removed the beta label Oct 19, 2020
@darcyclarke darcyclarke removed this from the OSS - Sprint 19 milestone Nov 16, 2020
@wraithgar
Copy link
Member

A duplicate issue was created and it is the one we are using for tracking this #3149

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

No branches or pull requests

4 participants