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] installing git dep on non-existent branch results in unhelpful error message #3149

Closed
ericprud opened this issue Apr 25, 2021 · 4 comments · Fixed by npm/pacote#82
Closed
Assignees
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@ericprud
Copy link

### Current Behavior:

Expected Behavior:

npm install with erroneous git version on a github dependency whines about cache "already exists"

Steps To Reproduce:

  1. with a fresh npm package.json, add a dep for a non-existent branch, e.g."dependencies": { "shex-test": "github:shexSpec/shexTest#master" }
  2. npm install --cache /tmp/brand-new-cache

Environment:

  • OS: Ubuntu 20.04

Error Message:

eric@touchy:/tmp/npmz/npm-user$ npm install --cache /tmp/brand-new-cache
npm ERR! code 128
npm ERR! command failed
npm ERR! command git clone --mirror -q ssh://git@github.com/shexSpec/shexTest.git /tmp/brand-new-cache/_cacache/tmp/git-clone-e421e02b/.git
npm ERR! fatal: destination path '/tmp/brand-new-cache/_cacache/tmp/git-clone-e421e02b/.git' already exists and is not an empty directory.

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/brand-new-cache/_logs/2021-04-25T16_32_24_722Z-debug.log

The real prob had nothing to do with the cache, but simply that the master branch was renamed to main (which makes this a timely UI experience to improve).

Related issue:
If you change to an existent branch (e.g. main), npm i, change back, and npm i again, you see no error. The package-lock.json entry was changed to "shex-test": "github:shexSpec/shexTest#master" but the node_modules entry appeared to stay on main. While playing with this, i had to reset to square 1 with rm -rf node_modules/ package-lock.json /tmp/brand-new-cache/ to get around this overly agreeable behavior.

@ericprud ericprud 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 Apr 25, 2021
@isaacs isaacs changed the title [BUG] <title> [BUG] installing git dep on non-existent branch results in unhelpful error message Apr 27, 2021
@darcyclarke darcyclarke removed the Needs Triage needs review for next steps label Jun 11, 2021
@darcyclarke
Copy link
Contributor

Action: determine where/when to throw error for non-existent branch

@lukekarrys
Copy link
Contributor

lukekarrys commented Jul 2, 2021

This will be fixed when pacote@11.3.5 lands in the release on 2021-07-15.

@ondrejsova
Copy link

still getting this error on 8.19.2 when using a commit hash

@DePasqualeOrg
Copy link

DePasqualeOrg commented Nov 19, 2024

I was also getting this error on npm 10.9.0 when installing packages from GitHub with or without a commit hash. The error message is not helpful, because in fact the problem was that a dependency specified a commit hash that no longer existed in the repo.

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

Successfully merging a pull request may close this issue.

5 participants