Skip to content

npm install from private git repository failed #2022

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

Closed
W3mediaPl opened this issue Oct 23, 2020 · 18 comments
Closed

npm install from private git repository failed #2022

W3mediaPl opened this issue Oct 23, 2020 · 18 comments
Labels
Bug thing that needs fixing Duplicate duplicate of another, existing issue Release 7.x work is associated with a specific npm 7 release

Comments

@W3mediaPl
Copy link

W3mediaPl commented Oct 23, 2020

NPM 7.x has problem with instaling module from private git repository and gives me ERR_INVALID_URL error. I'm sure that URL is correct, because with npm 6.x everything works fine.

COMMAND:
npm install --save git+ssh://[email protected]:somerepository.git

npm ERR! code ERR_INVALID_URL
npm ERR! Invalid URL: git+ssh://[email protected]:somerepository.git

Environment:
OSX 10.15.4

There is debug log:

0 verbose cli [
0 verbose cli   '/usr/local/bin/node',
0 verbose cli   '/usr/local/bin/npm',
0 verbose cli   'install',
0 verbose cli   '--save',
0 verbose cli   'git+ssh://git@############### '
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 0ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 2ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:/Users/###############/www/_node/###############/.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/Users/###############/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 7ms
19 verbose npm-session 01aeaf9109274f1e
20 timing npm:load Completed in 15ms
21 timing arborist:ctor Completed in 0ms
22 timing arborist:ctor Completed in 1ms
23 timing idealTree:init Completed in 24ms
24 timing idealTree Completed in 3277ms
25 timing command:install Completed in 3281ms
26 verbose stack TypeError [ERR_INVALID_URL]: Invalid URL: git+ssh://git@git.############### 
26 verbose stack     at new NodeError (node:internal/errors:258:15)
26 verbose stack     at onParseError (node:internal/url:258:9)
26 verbose stack     at new URL (node:internal/url:334:5)
26 verbose stack     at new URL (node:internal/url:331:22)
26 verbose stack     at GitFetcher.[_addGitSha] (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/git.js:128:28)
26 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/pacote/lib/git.js:228:27
26 verbose stack     at processTicksAndRejections (node:internal/process/task_queues:93:5)
26 verbose stack     at async Arborist.[retrieveSpecName] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:410:18)
26 verbose stack     at async Promise.all (index 0)
26 verbose stack     at async Arborist.[applyUserRequests] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:368:7)
27 verbose cwd /Users/###############/www/_node/############### 
28 verbose Darwin 19.4.0
29 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "git+ssh://git@git.###############"
30 verbose node v15.0.0
31 verbose npm  v7.0.2
32 error code ERR_INVALID_URL
33 error Invalid URL: git+ssh://git@###############
34 verbose exit 1

@W3mediaPl W3mediaPl 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 Oct 23, 2020
@jimmyhlee94
Copy link

I had a similar issue... for me I had to replace the : after the domain to a / for it to work.

so instead of git+ssh://[email protected]:somerepository.git
try git+ssh://[email protected]/somerepository.git

@W3mediaPl
Copy link
Author

I tried this way, but still failed.

@jmenashe
Copy link

jmenashe commented Nov 4, 2020

This was working fine 2 months ago, but now it's not.

@matschik
Copy link

matschik commented Nov 10, 2020

Got the same problem with git+ssh://[email protected]:john/pkg-name#semver:^1.1.4 from Gitlab.
Apparently new URL(pkgURL) in NPM 7.0.3 is throwing this error. No problem with Yarn.

@davidnorthetal
Copy link

Also getting hit with this, is downgrading the only solution here?

@xswei
Copy link

xswei commented Dec 8, 2020

I had a similar issue... for me I had to replace the : after the domain to a / for it to work.

so instead of git+ssh://[email protected]:somerepository.git
try git+ssh://[email protected]/somerepository.git

Are there relevant documents? thanks

@JamesPeck
Copy link

git+ssh://git@privatereponame/orgname/somerepo.git isn't working for us when it used to on v6

@greggman
Copy link

greggman commented Dec 28, 2020

Similar problem. npm6 works with a url of git://publicdomain/publicname/reponame.git#tag but npm 7 translates that to git+ssh:... which then fails because other users don't have access to the public repo via ssh

@ozkankirik
Copy link

I'm using npm 7.3.0, I hit exactly same error. I've no problems with npm6

it works if protocol git+ssh:// section removed. But this behavior is not expected.

@darcyclarke
Copy link
Contributor

Closing as this seems to be a duplicate of: #2054

@darcyclarke darcyclarke added Duplicate duplicate of another, existing issue and removed Needs Triage needs review for next steps labels Jan 8, 2021
@cmandlbaur
Copy link

@darcyclarke the linked issue seems to address install failures using git+https, whereas this issue is to do with git+ssh.

@AndreKR
Copy link

AndreKR commented Feb 9, 2021

@darcyclarke @cmandlbaur Yeah, the other issue is about authentication with git+https while this one is about ERR_INVALID_URL with git+ssh. Totally different problems.

@perryfaro
Copy link

perryfaro commented Feb 15, 2021

@cmandlbaur @AndreKR I think it is a problemen with node 15.x.x since it works with node 14.x.x and lower using npm version 7.5.4.

@stephanbehm
Copy link

npm install -g npm@latest solved the issue for me today.

A colleague solved the issue by downgrading npm back to v6.

@Pauligrinder
Copy link

npm install -g npm@latest solved the issue for me today.

Hey thanks for mentioning this. This worked for me as well! (Installing an npm package from a vsonline private repo)

@kerventkm
Copy link

I have this issue, please any help?

(eeg-models-u_TfKdj2-py3.9) (base) kerven@kerven-Aspire-E1-571G:~/Desktop/Diplom Thesis/eeg-models$ pre-commit run --all-files
[INFO] Installing environment for https://github.com/pre-commit/mirrors-prettier.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/kerven/.cache/pre-commit/repofk4acz7c/node_env-system/bin/node', '/usr/bin/npm', 'install', '-g', '/home/kerven/.cache/pre-commit/repofk4acz7c/placeholder_package-0.0.0.tgz', '[email protected]')
return code: 1
expected return code: 0
stdout: (none)
stderr:
npm ERR! code ERR_INVALID_URL
npm ERR! Invalid URL

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/kerven/.npm/_logs/2022-05-22T05_59_18_706Z-debug-0.log

Check the log at /home/kerven/.cache/pre-commit/pre-commit.log

0 verbose cli [
0 verbose cli '/usr/bin/node',
0 verbose cli '/usr/bin/npm',
0 verbose cli 'install',
0 verbose cli '-g',
0 verbose cli '/home/kerven/.cache/pre-commit/repofk4acz7c/placeholder_package-0.0.0.tgz',
0 verbose cli '[email protected]'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 3ms
5 timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 3ms
8 timing config:load:env Completed in 1ms
9 timing config:load:project Completed in 13ms
10 timing config:load:file:/home/kerven/.npmrc Completed in 3ms
11 timing config:load:user Completed in 3ms
12 timing config:load:file:/home/kerven/.cache/pre-commit/repofk4acz7c/node_env-system/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:validate Completed in 1ms
15 timing config:load:credentials Completed in 2ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 30ms
18 timing npm:load:configload Completed in 30ms
19 timing npm:load:setTitle Completed in 1ms
20 timing config:load:flatten Completed in 4ms
21 timing npm:load:display Completed in 6ms
22 verbose logfile /home/kerven/.npm/_logs/2022-05-22T05_59_18_706Z-debug-0.log
23 timing npm:load:logFile Completed in 8ms
24 timing npm:load:timers Completed in 0ms
25 timing npm:load:configScope Completed in 0ms
26 timing npm:load Completed in 46ms
27 timing arborist:ctor Completed in 2ms
28 silly logfile start cleaning logs, removing 1 files
29 timing idealTree:init Completed in 8ms
30 timing idealTree:userRequests Completed in 61ms
31 silly idealTree buildDeps
32 silly fetch manifest placeholder_package@file:../../placeholder_package-0.0.0.tgz
33 silly fetch manifest [email protected]
34 silly placeDep ROOT [email protected] OK for: want: file:../../placeholder_package-0.0.0.tgz
35 silly placeDep ROOT prettier@ OK for: want: 2.6.2
36 timing idealTree:#root Completed in 31ms
37 timing idealTree:node_modules/placeholder_package Completed in 0ms
38 timing idealTree:node_modules/prettier Completed in 0ms
39 timing idealTree:buildDeps Completed in 33ms
40 timing idealTree:fixDepFlags Completed in 1ms
41 timing idealTree Completed in 104ms
42 timing command:install Completed in 115ms
43 verbose stack TypeError [ERR_INVALID_URL]: Invalid URL
43 verbose stack at new NodeError (node:internal/errors:372:5)
43 verbose stack at URL.onParseError (node:internal/url:553:9)
43 verbose stack at new URL (node:internal/url:629:5)
43 verbose stack at getProxyUri (/usr/lib/node_modules/npm/node_modules/make-fetch-happen/lib/agent.js:157:53)
43 verbose stack at getAgent (/usr/lib/node_modules/npm/node_modules/make-fetch-happen/lib/agent.js:20:17)
43 verbose stack at remoteFetch (/usr/lib/node_modules/npm/node_modules/make-fetch-happen/lib/remote.js:31:17)
43 verbose stack at cacheFetch (/usr/lib/node_modules/npm/node_modules/make-fetch-happen/lib/cache/index.js:16:28)
43 verbose stack at async fetch (/usr/lib/node_modules/npm/node_modules/make-fetch-happen/lib/fetch.js:98:7)
43 verbose stack at async Arborist.[nodeFromEdge] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1081:19)
43 verbose stack at async Arborist.[buildDepStep] (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:950:11)
44 verbose cwd /home/kerven/.cache/pre-commit/repofk4acz7c
45 verbose Linux 5.13.0-41-generic
46 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "/home/kerven/.cache/pre-commit/repofk4acz7c/placeholder_package-0.0.0.tgz" "[email protected]"
47 verbose node v16.15.0
48 verbose npm v8.5.5
49 error code ERR_INVALID_URL
50 error Invalid URL
51 verbose exit 1
52 timing npm Completed in 436ms
53 verbose unfinished npm timer reify 1653199159021
54 verbose unfinished npm timer reify:loadTrees 1653199159028
55 verbose code 1
56 error A complete log of this run can be found in:
56 error /home/kerven/.npm/_logs/2022-05-22T05_59_18_706Z-debug-0.log

@OliHarris
Copy link

OliHarris commented Aug 5, 2022

Found this page by searching for string "node_modules/make-fetch-happen/lib/agent.js:157:53"

Seeing similar issue with output log:

15:41:05  npm info using [email protected]
15:41:05  npm info using [email protected]

Looks like may have to work on way to downgrade npm while keeping node 17..?

@Govindghosh
Copy link

PS E:\Learn\React js\learn\sstart> npx create-react-app my-utilite

Creating a new React app in E:\Learn\React js\learn\sstart\my-utilite.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

npm ERR! code ERR_INVALID_URL
npm ERR! Invalid URL

npm ERR! A complete log of this run can be found in: C:\Users\ok\AppData\Local\npm-cache_logs\2023-09-29T10_40_36_131Z-debug-0.log

Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... package.json
Deleting my-utilite/ from E:\Learn\React js\learn\sstart
Done.

can anybody help me..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Duplicate duplicate of another, existing issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests