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

Unsupported URL Type: git+git+ssh when shrinkwrapping modules from private github repos #7294

Closed
twhid opened this issue Feb 6, 2015 · 2 comments
Labels

Comments

@twhid
Copy link
Contributor

twhid commented Feb 6, 2015

Greetings,

shrinkwrap writes a bad protocol to npm-shrinkwrap if you originally installed from a private github repo. I.e. when the package.json dependency's protocol is git+ssh: then shrinkwrap generates a git+git+ssh: protocol.

I thought perhaps I could fix it here:

if (parsed.proto !== "git:") {

But that code doesn't seem to run during shrinkwrap. I'm not familiar with the innards of npm, If anyone can point me in the right direction, I'd be happy to submit a pull request.

These steps to reproduce. You need a private github repo:

npm -v 
2.5.0
npm install my-github/my-module --save

Now, package.json:

{
  "name": "npm-bug-test",
  "version": "1.0.0",
  "description": "test case to display git+git+ssh bug",
  "main": "index.js",
  "dependencies": {
    "my-module": "git+ssh://git@github.com:my-github/my-module"
  }
}
npm shrinkwrap

Now, npm-shrinkwrap.json

{
  "name": "npm-bug-test",
  "version": "1.0.0",
  "dependencies": {
    "my-module": {
      "version": "1.0.0",
      "from": "git+ssh://git@github.com:my-github/my-module",
      "resolved": "git+git+ssh://git@github.com:my-github/my-module#a3208a093052b06b2d45f282822536ba3c65e3c3",
// etc
npm install 

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install' ]
2 info using npm@2.5.0
3 info using node@v0.10.35
4 verbose node symlink /usr/local/bin/node
5 warn package.json npm-bug-test@1.0.0 No repository field.
6 warn package.json npm-bug-test@1.0.0 No README data
7 verbose readDependencies npm-shrinkwrap.json is overriding dependencies
8 info shrinkwrap file "/Users/me/projects/npm-bug-test/npm-shrinkwrap.json"
9 verbose readDependencies returned deps { my-module: 'git+git+ssh://git@github.com:my-github/my-module#a3208a093052b06b2d45f282822536ba3c65e3c3' }
10 verbose install where, deps [ '/Users/me/projects/npm-bug-test', [ 'my-module' ] ]
11 verbose install where, peers [ '/Users/me/projects/npm-bug-test', [] ]
12 info preinstall npm-bug-test@1.0.0
13 verbose readDependencies npm-shrinkwrap.json is overriding dependencies
14 info shrinkwrap file "/Users/me/projects/npm-bug-test/npm-shrinkwrap.json"
15 verbose readDependencies returned deps { my-module: 'git+git+ssh://git@github.com:my-github/my-module#a3208a093052b06b2d45f282822536ba3c65e3c3' }
16 verbose stack Error: Unsupported URL Type: git+git+ssh://git@github.com:my-github/my-module#a3208a093052b06b2d45f282822536ba3c65e3c3
16 verbose stack     at parseUrl (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:173:13)
16 verbose stack     at npa (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:74:12)
16 verbose stack     at resolver (/usr/local/lib/node_modules/npm/lib/install.js:756:42)
16 verbose stack     at null._onTimeout (/usr/local/lib/node_modules/npm/lib/install.js:751:7)
16 verbose stack     at Timer.listOnTimeout [as ontimeout] (timers.js:112:15)
17 verbose cwd /Users/me/projects/npm-bug-test
18 error Darwin 14.0.0
19 error argv "node" "/usr/local/bin/npm" "install"
20 error node v0.10.35
21 error npm  v2.5.0
22 error Unsupported URL Type: git+git+ssh://git@github.com:my-github/my-module#a3208a093052b06b2d45f282822536ba3c65e3c3
23 error If you need help, you may report this error at:
23 error     <http://github.com/npm/npm/issues>
24 verbose exit [ 1, true ]

@twhid
Copy link
Contributor Author

twhid commented Feb 9, 2015

New to npm's internal processes, getting up to speed.

Here's a simpler test case:

npm install my-github/my-module --save
npm ls

Error:

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'ls' ]
2 info using npm@2.5.0
3 info using node@v0.10.35
4 verbose node symlink /usr/local/bin/node
5 verbose stack Error: Unsupported URL Type: git+git+ssh://git@github.com:my-github/my-module#a3208a093052b06b2d45f282822536ba3c65e3c3
5 verbose stack     at parseUrl (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:173:13)
5 verbose stack     at npa (/usr/local/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:74:12)
5 verbose stack     at makeArchy_ (/usr/local/lib/node_modules/npm/lib/ls.js:280:9)
5 verbose stack     at /usr/local/lib/node_modules/npm/lib/ls.js:297:16
5 verbose stack     at Array.map (native)
5 verbose stack     at makeArchy_ (/usr/local/lib/node_modules/npm/lib/ls.js:296:24)
5 verbose stack     at makeArchy (/usr/local/lib/node_modules/npm/lib/ls.js:228:13)
5 verbose stack     at /usr/local/lib/node_modules/npm/lib/ls.js:65:13
5 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-installed/read-installed.js:138:5
5 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-installed/read-installed.js:251:14
6 verbose cwd /Users/me/projects/npm-bug-test
7 error Darwin 14.0.0
8 error argv "node" "/usr/local/bin/npm" "ls"
9 error node v0.10.35
10 error npm  v2.5.0
11 error Unsupported URL Type: git+git+ssh://git@github.com:my-github/my-module#a3208a093052b06b2d45f282822536ba3c65e3c3
12 error If you need help, you may report this error at:
12 error     <http://github.com/npm/npm/issues>
13 verbose exit [ 1, true ]

And, as opposed to my original comment, it is this line that causes the error:

if (parsed.proto !== "git:") {

@othiym23
Copy link
Contributor

Closed by a2e04bd and 0f87f5e. Thanks for pointing this out!

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

No branches or pull requests

3 participants