Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm 5 fails to install git dependencies from gerrit #16789

Closed
1 of 13 tasks
remcohaszing opened this issue May 30, 2017 · 16 comments
Closed
1 of 13 tasks

npm 5 fails to install git dependencies from gerrit #16789

remcohaszing opened this issue May 30, 2017 · 16 comments

Comments

@remcohaszing
Copy link

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • Other (see below for feature requests):

What's going wrong?

npm 5 crashed when I try to install a dependency from a Gerrit host. This worked fine when using npm 4.x.

I have the following dependency:

  "project_name": "git+https://$GERRIT_HOST/gerrit/$GERRIT_PROJECT_NAME#$GIT_HASH",

npm crashes on the following command (I rewrote it a bit replacing actual values with representative environment variables):

$ REFSPEC=$GERRIT_PROJECT_ID/$GERRIT_SHORT_CHANGE_ID/$GERRIT_PATCHSET
$ git clone --depth=1 -q -b $REFSPEC https://$GERRIT_HOST/gerrit/$GERRIT_PROJECT_NAME $HOME/.cache/npm/_cacache/tmp/git-clone-74d2e568
warning: Could not find remote branch $REFSPEC to clone.
fatal: Remote branch $REFSPEC not found in upstream origin

The following does work:

git clone --depth=1 https://$GERRIT_HOST/gerrit/$GERRIT_PROJECT_NAME
git fetch https://$GERRIT_HOST/gerrit/$GERRIT_PROJECT_NAME refs/changes/$REFSPEC
git checkout FETCH_HEAD

How can the CLI team reproduce the problem?

The team needs to try to depend on a git dependency from a Gerrit host. Since I'm using a private host, I can't give any further information.

supporting information:

  • npm -v prints: 5.0.0
  • node -v prints: v7.10.0
  • npm config get registry prints: https://registry.npmjs.org/
  • Windows, OS X/macOS, or Linux?: Linux
  • Network issues:
    • Geographic location where npm was run:
    • I use a proxy to connect to the npm registry.
    • I use a proxy to connect to the web.
    • I use a proxy when downloading Git repos.
    • I access the npm registry via a VPN
    • I don't use a proxy, but have limited or unreliable internet access.
  • Container:
    • I develop using Vagrant on Windows.
    • I develop using Vagrant on OS X or Linux.
    • I develop / deploy using Docker.
    • I deploy to a PaaS (Triton, Heroku).
@zkat zkat added the npm5 label May 30, 2017
@zkat
Copy link
Contributor

zkat commented May 30, 2017

Ooh this is probably some weird detail with shell expansion in pacote.

@apaleslimghost
Copy link
Contributor

I have something similar with git dependencies from Bitbucket Server.

the line in package.json:

"circular-list": "git+ssh://git@[REDACTED]/circular-list.git#v1.0.2",

output:

npm ERR! code 128
npm ERR! Command failed: /usr/local/bin/git clone --depth=1 -q -b v1.0.2^{} ssh://git@[REDACTED]/circular-list.git /Users/matthew.brennan/.npm/_cacache/tmp/git-clone-d9115048
npm ERR! warning: templates not found /var/folders/0m/smmrszcj367g1ds3nkjrv2y42l6kl3/T/pacote-git-template-tmp/git-clone-410ac485
npm ERR! fatal: Remote branch v1.0.2^{} not found in upstream origin
npm ERR!

@zkat
Copy link
Contributor

zkat commented May 30, 2017

@quarterto could you file this as an issue against https://github.com/zkat/pacote? This is definitely a hiccup with ref parsing pacote-side.

@apaleslimghost
Copy link
Contributor

@zkat done: zkat/pacote#90

@zkat zkat added the git label May 31, 2017
@jaslo
Copy link

jaslo commented May 31, 2017

I have a similar problem -- no crash, but no install either with dependencies from amazon codecommit.
git+ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/myreponame

@zkat
Copy link
Contributor

zkat commented Jun 1, 2017

@remcohaszing I just pushed out [email protected] with a bunch of fixes. Could you give that a whirl and let me know if it fixed this?

@remcohaszing
Copy link
Author

@zkat I just [email protected], but it doesn't make a difference.

@zkat
Copy link
Contributor

zkat commented Jun 1, 2017

@remcohaszing then I guess you're using a [email protected]:user/project format ssh URI? That's the type that's currently known to be broken.

@zkat
Copy link
Contributor

zkat commented Jun 1, 2017

(I'm fixing this right now, btw)

@zkat
Copy link
Contributor

zkat commented Jun 1, 2017

And here's the PR: npm/npm-package-arg#24

@zkat
Copy link
Contributor

zkat commented Jun 1, 2017

Closing as a duplicate of #16726

@zkat zkat closed this as completed Jun 1, 2017
@remcohaszing
Copy link
Author

This issue still persists in [email protected], which I believe has been fixed.

@remcohaszing then I guess you're using a [email protected]:user/project format ssh URI? That's the type that's currently known to be broken.

No, it's git+https://foo.com/path/to/project. (It's in the original issue description.)

@zkat
Copy link
Contributor

zkat commented Jun 5, 2017

Reopening. If the previous patch didn't work, I think this is likely to have to do with #16898, which is fixed by zkat/pacote#97.

I've released a new npm canary with this patch: [email protected]. You can install it with npm i -g [email protected]. If you have the time, please try that and see if it fixes it. Otherwise, I guess there's yet another fun new surprise to figure out :P

@zkat zkat reopened this Jun 5, 2017
@remcohaszing
Copy link
Author

I suppose that patch got merged in 5.0.3, because everything works now. 😄

@zkat
Copy link
Contributor

zkat commented Jun 6, 2017

😎 cool. Thanks for trying it out 👍

@zkat
Copy link
Contributor

zkat commented Jun 6, 2017

And like, seriously, thanks y'all for reporting all this and letting me flop around a bit about it. git stuff needed some love ^_^;;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants