0

I failed to run npm install --global eas-cli, with error TypeError [ERR_INVALID_URL]: Invalid URL as below:

➜  ~ node -v
v16.20.2
➜  ~ npm -v
8.19.4
➜  ~ npm config get proxy
null
➜  ~ npm config get https-proxy
null
➜  ~ npm config get registry
https://registry.npmjs.org/
➜  ~ npm config get http-proxy
undefined
➜  ~ npm install --global eas-cli
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @expo/[email protected]
npm WARN Found: expo-modules-autolinking@undefined
npm WARN node_modules/eas-cli/node_modules/expo-modules-autolinking
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer expo-modules-autolinking@">=0.8.1" from @expo/[email protected]
npm WARN node_modules/eas-cli/node_modules/@expo/prebuild-config
npm WARN   @expo/prebuild-config@"6.2.5" from [email protected]
npm WARN   node_modules/eas-cli
npm ERR! code ERR_INVALID_URL
npm ERR! Invalid URL

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/wliu/.npm/_logs/2023-11-24T19_14_48_930Z-debug-0.log

And in the log file:

1492 verbose stack TypeError [ERR_INVALID_URL]: Invalid URL
1492 verbose stack     at new NodeError (node:internal/errors:387:5)
1492 verbose stack     at URL.onParseError (node:internal/url:565:9)
1492 verbose stack     at new URL (node:internal/url:641:5)
1492 verbose stack     at getProxyUri (/Users/wliu/.nvm/versions/node/v16.20.2/lib/node_modules/npm/node_modules/make-fetch-happen/lib/agent.js:160:53)
1492 verbose stack     at getAgent (/Users/wliu/.nvm/versions/node/v16.20.2/lib/node_modules/npm/node_modules/make-fetch-happen/lib/agent.js:21:17)
1492 verbose stack     at remoteFetch (/Users/wliu/.nvm/versions/node/v16.20.2/lib/node_modules/npm/node_modules/make-fetch-happen/lib/remote.js:31:17)
1492 verbose stack     at cacheFetch (/Users/wliu/.nvm/versions/node/v16.20.2/lib/node_modules/npm/node_modules/make-fetch-happen/lib/cache/index.js:16:28)
1492 verbose stack     at async fetch (/Users/wliu/.nvm/versions/node/v16.20.2/lib/node_modules/npm/node_modules/make-fetch-happen/lib/fetch.js:98:7)
1492 verbose stack     at async RegistryFetcher.packument (/Users/wliu/.nvm/versions/node/v16.20.2/lib/node_modules/npm/node_modules/pacote/lib/registry.js:92:19)
1492 verbose stack     at async RegistryFetcher.manifest (/Users/wliu/.nvm/versions/node/v16.20.2/lib/node_modules/npm/node_modules/pacote/lib/registry.js:124:23)
1493 verbose cwd /Users/wliu/.npm/_logs
1494 verbose Darwin 21.6.0
1495 verbose node v16.20.2
1496 verbose npm  v8.19.4

[UPDATE] Changed to node v21, same error:

➜  ~ node -v
v21.2.0
➜  ~ npm -v
10.2.3
➜  ~ npm install --global eas-cli
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @expo/[email protected]
npm WARN Found: expo-modules-autolinking@undefined
npm WARN node_modules/eas-cli/node_modules/expo-modules-autolinking
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer expo-modules-autolinking@">=0.8.1" from @expo/[email protected]
npm WARN node_modules/eas-cli/node_modules/@expo/prebuild-config
npm WARN   @expo/prebuild-config@"6.2.5" from [email protected]
npm WARN   node_modules/eas-cli
npm ERR! code ERR_INVALID_URL
npm ERR! Invalid URL

npm ERR! A complete log of this run can be found in: /Users/wliu/.npm/_logs/2023-11-24T19_21_26_890Z-debug-0.log

*** And here is the log ***

1505 timing idealTree:node_modules/eas-cli/node_modules/rimraf/node_modules/glob Completed in 2ms
1506 silly placeDep node_modules/eas-cli/node_modules/rimraf [email protected] OK for: [email protected] want: ^1.1.7
1507 timing idealTree:node_modules/eas-cli/node_modules/rimraf/node_modules/minimatch Completed in 1ms
1508 timing idealTree:node_modules/eas-cli/node_modules/rimraf/node_modules/brace-expansion Completed in 0ms
1509 timing idealTree:node_modules/eas-cli/node_modules/supports-hyperlinks/node_modules/supports-color Completed in 0ms
1510 timing idealTree:node_modules/eas-cli/node_modules/tar/node_modules/mkdirp Completed in 0ms
1511 timing idealTree:node_modules/eas-cli/node_modules/tempy/node_modules/type-fest Completed in 0ms
1512 timing idealTree:node_modules/eas-cli/node_modules/xcode/node_modules/uuid Completed in 0ms
1513 timing idealTree:node_modules/eas-cli/node_modules/xml2js/node_modules/xmlbuilder Completed in 0ms
1514 timing idealTree:node_modules/eas-cli/node_modules/@expo/image-utils/node_modules/cross-spawn/node_modules/semver Completed in 0ms
1515 timing idealTree:buildDeps Completed in 1466ms
1516 timing idealTree:fixDepFlags Completed in 3ms
1517 timing idealTree Completed in 1482ms
1518 timing command:install Completed in 1496ms
1519 verbose stack TypeError: Invalid URL
1519 verbose stack     at new URL (node:internal/url:783:36)
1519 verbose stack     at getProxy (/Users/wliu/.nvm/versions/node/v21.2.0/lib/node_modules/npm/node_modules/@npmcli/agent/lib/proxy.js:81:10)
1519 verbose stack     at getAgent (/Users/wliu/.nvm/versions/node/v21.2.0/lib/node_modules/npm/node_modules/@npmcli/agent/lib/index.js:19:23)
1519 verbose stack     at remoteFetch (/Users/wliu/.nvm/versions/node/v21.2.0/lib/node_modules/npm/node_modules/make-fetch-happen/lib/remote.js:37:17)
1519 verbose stack     at cacheFetch (/Users/wliu/.nvm/versions/node/v21.2.0/lib/node_modules/npm/node_modules/make-fetch-happen/lib/cache/index.js:16:28)
1519 verbose stack     at async fetch (/Users/wliu/.nvm/versions/node/v21.2.0/lib/node_modules/npm/node_modules/make-fetch-happen/lib/fetch.js:98:7)
1519 verbose stack     at async RegistryFetcher.packument (/Users/wliu/.nvm/versions/node/v21.2.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:87:19)
1519 verbose stack     at async RegistryFetcher.manifest (/Users/wliu/.nvm/versions/node/v21.2.0/lib/node_modules/npm/node_modules/pacote/lib/registry.js:118:23)
1519 verbose stack     at async #nodeFromEdge (/Users/wliu/.nvm/versions/node/v21.2.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1049:19)
1519 verbose stack     at async #loadPeerSet (/Users/wliu/.nvm/versions/node/v21.2.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1310:11)
1520 verbose cwd /Users/wliu
1521 verbose Darwin 21.6.0
1522 verbose node v21.2.0
1523 verbose npm  v10.2.3
1524 error code ERR_INVALID_URL
1525 error Invalid URL
1526 verbose exit 1
4
  • You should really consider using a more modern version of node. Commented Nov 24, 2023 at 19:20
  • Thanks! I was changed to 16 from 21. Let me change it back to 21 and try again. Commented Nov 24, 2023 at 19:21
  • @ElvisAdomnica, thanks for the comment. I changed to v21, but same error. Commented Nov 24, 2023 at 19:23
  • Thank you Elvis! I resolved it by adding proxy settings to npm. Commented Nov 24, 2023 at 19:30

1 Answer 1

0

I resolved by setting npm proxy:

➜  ~ npm config set proxy http://127.0.0.1:7890
➜  ~ npm config set https-proxy http://127.0.0.1:7890

I do have a proxy on my Mac, but I am not sure how it affects the npm.

Sign up to request clarification or add additional context in comments.

1 Comment

hm, interesting, I guess the proxy is not applied system wide. glad you solved it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.