pnpm: pnpm install bug on certainly formed git+ssh repository URLs

I’m seeing that pnpm finally supports git+ssh, but there is a parsing bug on certainly formed repository URLs. The test case is simple:

git+ssh://git@gitlab.domain.tld:/myproject/myrepo.git#master does work, while git+ssh://git@gitlab.domain.tld:myproject/myrepo.git#master does not, throwing the following error: ssh: Could not resolve hostname gitlab.domain.tld:myproject: Name or service not known

myproject seems to be interpreted as a host port instead of what it really is.

By default, self-hosted GitLab gives the second format, so it would be really useful to support it.

Thank you very much!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Here it is:

---
  0 debug pnpm:mkdirp: "/root/theProject/mycomponent/node_modules/.store"
  1 debug pnpm:install: "installing coffee-script@1.10.0"
  2 debug pnpm:install: "installing level@^1.4.0"
  3 debug pnpm:install: "installing lodash@^3.10.1"
  4 debug pnpm:install: "installing q@^1.4.1"
  5 debug pnpm:install: "installing mymodule@git+ssh://git@gitlab.domain.tld:myproject/myrepo.git#master"
  6 debug pnpm:install: "installing traverse@^0.6.6"
  7 debug pnpm:install: "installing zmq@2.13.0"
  8 debug pnpm:install: "installing chalk@^1.1.1"
  9 debug pnpm:install: "installing coffee-coverage@1.0.1"
  10 debug pnpm:install: "installing coffeelint@^1.12.1"
  11 debug pnpm:install: "installing istanbul@0.4.2"
  12 debug pnpm:install: "installing mocha@^2.2.4"
  13 debug pnpm:install: "installing should@^6.0.1"
  14 debug pnpm:install: "installing tcp-port-used@0.1.2"
  15 progress coffee-script@1.10.0: "resolving"
  16 verbose request: "uri https://registry.npmjs.org/coffee-script"
  17 verbose request: "no auth needed"
  18 info attempt: "registry request try #1 at 12:19:51"
  19 verbose request id: "374143efd47d9213"
  20 http request: "GET https://registry.npmjs.org/coffee-script"
  21 progress level@^1.4.0: "resolving"
  22 verbose request: "uri https://registry.npmjs.org/level"
  23 verbose request: "no auth needed"
  24 info attempt: "registry request try #1 at 12:19:51"
  25 http request: "GET https://registry.npmjs.org/level"
  26 progress lodash@^3.10.1: "resolving"
  27 verbose request: "uri https://registry.npmjs.org/lodash"
  28 verbose request: "no auth needed"
  29 info attempt: "registry request try #1 at 12:19:51"
  30 http request: "GET https://registry.npmjs.org/lodash"
  31 progress q@^1.4.1: "resolving"
  32 verbose request: "uri https://registry.npmjs.org/q"
  33 verbose request: "no auth needed"
  34 info attempt: "registry request try #1 at 12:19:51"
  35 http request: "GET https://registry.npmjs.org/q"
  36 progress mymodule@git+ssh://git@gitlab.domain.tld:myproject/myrepo.git#master: "resolved [object Object]"
  37 debug pnpm:mkdirp: "/root/theProject/mycomponent/node_modules"
  38 progress traverse@^0.6.6: "resolving"
  39 verbose request: "uri https://registry.npmjs.org/traverse"
  40 verbose request: "no auth needed"
  41 info attempt: "registry request try #1 at 12:19:51"
  42 http request: "GET https://registry.npmjs.org/traverse"
  43 progress zmq@2.13.0: "resolving"
  44 verbose request: "uri https://registry.npmjs.org/zmq"
  45 verbose request: "no auth needed"
  46 info attempt: "registry request try #1 at 12:19:51"
  47 http request: "GET https://registry.npmjs.org/zmq"
  48 progress chalk@^1.1.1: "resolving"
  49 verbose request: "uri https://registry.npmjs.org/chalk"
  50 verbose request: "no auth needed"
  51 info attempt: "registry request try #1 at 12:19:51"
  52 http request: "GET https://registry.npmjs.org/chalk"
  53 progress coffee-coverage@1.0.1: "resolving"
  54 verbose request: "uri https://registry.npmjs.org/coffee-coverage"
  55 verbose request: "no auth needed"
  56 info attempt: "registry request try #1 at 12:19:51"
  57 http request: "GET https://registry.npmjs.org/coffee-coverage"
  58 progress coffeelint@^1.12.1: "resolving"
  59 verbose request: "uri https://registry.npmjs.org/coffeelint"
  60 verbose request: "no auth needed"
  61 info attempt: "registry request try #1 at 12:19:51"
  62 http request: "GET https://registry.npmjs.org/coffeelint"
  63 progress istanbul@0.4.2: "resolving"
  64 verbose request: "uri https://registry.npmjs.org/istanbul"
  65 verbose request: "no auth needed"
  66 info attempt: "registry request try #1 at 12:19:51"
  67 http request: "GET https://registry.npmjs.org/istanbul"
  68 progress mocha@^2.2.4: "resolving"
  69 verbose request: "uri https://registry.npmjs.org/mocha"
  70 verbose request: "no auth needed"
  71 info attempt: "registry request try #1 at 12:19:51"
  72 http request: "GET https://registry.npmjs.org/mocha"
  73 progress should@^6.0.1: "resolving"
  74 verbose request: "uri https://registry.npmjs.org/should"
  75 verbose request: "no auth needed"
  76 info attempt: "registry request try #1 at 12:19:51"
  77 http request: "GET https://registry.npmjs.org/should"
  78 progress tcp-port-used@0.1.2: "resolving"
  79 verbose request: "uri https://registry.npmjs.org/tcp-port-used"
  80 verbose request: "no auth needed"
  81 info attempt: "registry request try #1 at 12:19:51"
  82 http request: "GET https://registry.npmjs.org/tcp-port-used"
  83 progress mymodule@git+ssh://git@gitlab.domain.tld:myproject/myrepo.git#master: "download-queued"
  84 debug pnpm:git: "cloning git repository from ssh://git@gitlab.domain.tld:myproject/myrepo.git"
  85 debug pnpm:git: "executing git with args clone,-b,master,ssh://git@gitlab.domain.tld:myproject/myrepo.git,/root/theProject/mycomponent/node_modules/.store/ssh:++git@gitlab.domain.tld:myproject+myrepo.git#master/_,--single-branch"
  86 debug pnpm:git: "failed to clone repository from ssh://git@gitlab.domain.tld:myproject/myrepo.git"
  87 progress mymodule@git+ssh://git@gitlab.domain.tld:myproject/myrepo.git#master: "error Error: failed to clone repository from ssh://git@gitlab.domain.tld:myproject/myrepo.git\n        Cloning into '/root/theProject/mycomponent/node_modules/.store/ssh:++git@gitlab.domain.tld:myproject+myrepo.git#master/_'...\nssh: Could not resolve hostname gitlab.domain.tld:myproject: Name or service not known\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nError: failed to clone repository from ssh://git@gitlab.domain.tld:myproject/myrepo.git\n        Cloning into '/root/theProject/mycomponent/node_modules/.store/ssh:++git@gitlab.domain.tld:myproject+myrepo.git#master/_'...\nssh: Could not resolve hostname gitlab.domain.tld:myproject: Name or service not known\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\n    at errorHandler (/usr/lib/node_modules/pnpm/lib/resolve/git.js:50:20)\n    at ChildProcess.<anonymous> (/usr/lib/node_modules/pnpm/lib/resolve/git.js:47:43)\n    at emitTwo (events.js:87:13)\n    at ChildProcess.emit (events.js:172:7)\n    at maybeClose (internal/child_process.js:818:16)\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)"
  88 error : "Error: failed to clone repository from ssh://git@gitlab.domain.tld:myproject/myrepo.git\n        Cloning into '/root/theProject/mycomponent/node_modules/.store/ssh:++git@gitlab.domain.tld:myproject+myrepo.git#master/_'...\nssh: Could not resolve hostname gitlab.domain.tld:myproject: Name or service not known\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\nError: failed to clone repository from ssh://git@gitlab.domain.tld:myproject/myrepo.git\n        Cloning into '/root/theProject/mycomponent/node_modules/.store/ssh:++git@gitlab.domain.tld:myproject+myrepo.git#master/_'...\nssh: Could not resolve hostname gitlab.domain.tld:myproject: Name or service not known\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\n    at errorHandler (/usr/lib/node_modules/pnpm/lib/resolve/git.js:50:20)\n    at ChildProcess.<anonymous> (/usr/lib/node_modules/pnpm/lib/resolve/git.js:47:43)\n    at emitTwo (events.js:87:13)\n    at ChildProcess.emit (events.js:172:7)\n    at maybeClose (internal/child_process.js:818:16)\n    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)"

This Issue is quite hold, but I’m experiencing an Issue heavily related:

(Notice the different chars after *.server)

  1. pnpm install git+ssh://git@private.gitlab.server/something/repo (works)
  2. pnpm install git+ssh://git@private.gitlab.server:/something/repo (works)
  3. pnpm install git+ssh://git@private.gitlab.server:something/repo (works not)

Whereas (3) also works with standard npm.

Encountered this, since we have (3) in some package.json files which formerly were handled via npm (and everything worked as expected) but encountered Invalid URL: git+ssh://[...] Error with pnpm.

Imo pnpm should handle all the git url forms that npm handles…

Works great! Thank you very much!