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] git+ssh does not work with version 8.16 #5278

Closed
2 tasks done
Tracked by #599
VeXell opened this issue Aug 8, 2022 · 22 comments · Fixed by #5758
Closed
2 tasks done
Tracked by #599

[BUG] git+ssh does not work with version 8.16 #5278

VeXell opened this issue Aug 8, 2022 · 22 comments · Fixed by #5758
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release

Comments

@VeXell
Copy link

VeXell commented Aug 8, 2022

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Hello

Using the latest version of npm 8.16 and latest 14.20 version of node.js.

I have few dependencies which i install from local git server.
When i remove node_modules folder and want to install packages again with command npm i i get error:

2833 verbose stack TypeError [ERR_INVALID_URL]: Invalid URL: git+ssh://git@***:frontend/utils.git#6d45447e0c5eb6cd2e3edf05a8c5a9bb81950c79
2833 verbose stack     at new NodeError (internal/errors.js:322:7)
2833 verbose stack     at onParseError (internal/url.js:270:9)
2833 verbose stack     at new URL (internal/url.js:346:5)
2833 verbose stack     at Arborist.[registryResolved] (***/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:721:25)
2833 verbose stack     at Arborist.[extractOrLink] (***/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:641:72)
2833 verbose stack     at ***/.nvm/versions/node/v14.20.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:607:35

But with npm 8.15.1 is works fine.

Expected Behavior

Packages with git+ssh path should be installed

Environment

  • npm: 8.16.0
  • Node.js: v14.20.0
  • OS Name: MacOS 11.6.8
  • System Model Name: Macbook Pro
@VeXell VeXell added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Aug 8, 2022
@Delagen
Copy link

Delagen commented Aug 10, 2022

The same
npm: 8.16.0
Node.js: v18.7.0
OS Name: Windows 11

@bnpoirier
Copy link

Same here
npm: 8.17.0
Node.js: v16.16.0
OS Name: Windows 11

@Delagen
Copy link

Delagen commented Aug 22, 2022

Any news? 8.18.0 version already released

@lazybobcat
Copy link

Same here. All our pipelines fail, I had to fix all NPM versions to 8.15.

@frank-dspeed
Copy link

i even get now errors like npm exec not working with packages anymore when one includes a git dependencie is in the packages it does fail silently

@lukekarrys lukekarrys added Priority 1 high priority issue and removed Needs Triage needs review for next steps labels Sep 1, 2022
@bigbossx
Copy link

bigbossx commented Sep 9, 2022

throw error ERR_INVALID_URL in this line

const resolvedURL = new URL(resolved)

node URL not support parse git+ssh://

@Delagen
Copy link

Delagen commented Sep 9, 2022

@visonm I think that they need to use

const {parse}=require("node:url");

instead of global version of URL, because of Node.JS global URL is strict whatwg version, but Chromium is some patched version

@bigbossx
Copy link

bigbossx commented Sep 9, 2022

@visonm I think that they need to use

const {parse}=require("node:url");

instead of global version of URL, because of Node.JS global URL is strict whatwg version, but Chromium is some patched version

You are right. you can try send a fix pr.
I'm not completely familiar with how npmcli works.

@Delagen
Copy link

Delagen commented Sep 9, 2022

@visonm created )

@wraithgar
Copy link
Member

This is missing steps to reproduce. What entry in your package.json causes this?

@VeXell
Copy link
Author

VeXell commented Sep 14, 2022

This is missing steps to reproduce. What entry in your package.json causes this?

@wraithgar

For example in my case access to local git server.
You can try any lib source with git+ssh

"devDependencies": {
       ...
        "etools": "git+ssh://git@git.***:frontend/dev-build-tools.git",
       ...
    }

@lazybobcat
Copy link

Any package comming from github or gitlab. For us that's a private gitlab repository, I can't link it here.

@Delagen
Copy link

Delagen commented Sep 14, 2022

#5487 (comment)

@lazybobcat
Just replace colon with slash as workaround

"devDependencies": {
       ...
        "etools": "git+ssh://git@git.***/frontend/dev-build-tools.git",
       ...
    }

@stadja
Copy link

stadja commented Sep 30, 2022

I have the same problem and @Delagen workaround fixed it !

@ozkankirik
Copy link

Still same problem exists!
It's critical to use local git repositories!
please write a test for this condition, is it possible to fix and commit it as soon as possible

@breisig
Copy link

breisig commented Oct 13, 2022

Same issue with npm cli bundled with nodejs 16.18.0

@breisig
Copy link

breisig commented Oct 17, 2022

This is a serious issue that needs to get fixed ASAP!

@darcyclarke darcyclarke assigned lukekarrys, nlf and fritzy and unassigned fritzy Oct 20, 2022
lukekarrys added a commit that referenced this issue Oct 26, 2022
Previously this was using `new URL` which would fail on some urls that
`hosted-git-info` is able to parse. But if we still get a url that can't
be parsed, we now set it to be removed from the tree instead of
erroring.

Fixes: #5278
lukekarrys added a commit that referenced this issue Oct 26, 2022
Previously this was using `new URL` which would fail on some urls that
`hosted-git-info` is able to parse. But if we still get a url that can't
be parsed, we now set it to be removed from the tree instead of
erroring.

Fixes: #5278
lukekarrys added a commit that referenced this issue Oct 27, 2022
Previously this was using `new URL` which would fail on some urls that
`hosted-git-info` is able to parse. But if we still get a url that can't
be parsed, we now set it to be removed from the tree instead of
erroring.

Fixes: #5278
lukekarrys added a commit that referenced this issue Oct 27, 2022
Previously this was using `new URL` which would fail on some urls that
`hosted-git-info` is able to parse. But if we still get a url that can't
be parsed, we now set it to be removed from the tree instead of
erroring.

Fixes: #5278
lukekarrys added a commit that referenced this issue Oct 27, 2022
Previously this was using `new URL` which would fail on some urls that
`hosted-git-info` is able to parse. But if we still get a url that can't
be parsed, we now set it to be removed from the tree instead of
erroring.

Fixes: #5278
wraithgar pushed a commit that referenced this issue Nov 1, 2022
Previously this was using `new URL` which would fail on some urls that
`hosted-git-info` is able to parse. But if we still get a url that can't
be parsed, we now set it to be removed from the tree instead of
erroring.

Fixes: #5278
wraithgar pushed a commit that referenced this issue Nov 1, 2022
Previously this was using `new URL` which would fail on some urls that
`hosted-git-info` is able to parse. But if we still get a url that can't
be parsed, we now set it to be removed from the tree instead of
erroring.

Fixes: #5278
@1765659645
Copy link

Is there a solution for gitlab url for https?like this:
git+https://xxx.com/xxx/common-react-components.git#3.7.3

@stadja
Copy link

stadja commented Dec 7, 2022

Is there a solution for gitlab url for https?like this: git+https://xxx.com/xxx/common-react-components.git#3.7.3

I had the same problem and @Delagen workaround fixed it !

@1765659645
Copy link

有没有针对https的gitlab url的解决方案?像这样:git+ https://xxx.com/xxx/common-react-components.git#3.7.3

我遇到了同样的问题@Delagen 解决方法修复了它!

Did you change https to ssh and that solved it?

@stadja
Copy link

stadja commented Dec 7, 2022

Sorry, I didn't read your problem well.
What is your problem exactly ? Https doesn't work ?

@1765659645
Copy link

I'm https now, how to fix it without modifying it to ssh way?

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