In my windows-10, I installed:
nodejs-v16.13.0
npm -v8.1.0
When I tried to run npm install -g @angular/cli
I got this error:
npm ERR! code ERR_INVALID_URL
npm ERR! Invalid URL
How do I get this resolve?
Thanks
I just reconfigure proxy using this command:
npm config set proxy http://username:password@host:port
and it worked!
Generally there is a log file associated with this message :
npm ERR! code ERR_INVALID_URL npm ERR! Invalid URL npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\....\AppData\Local\npm-cache\_logs\2021-11-04T09_13_08_065Z-debug.log
You can see more details in this file. I had the same problem, in my case I simply omitted the "http://" when I initially set up the proxy :
npm config set proxy "http://127.0.0.1:3128/" here !!! ^^^^^^^
For reference, it failed with this trace :
39 verbose stack TypeError [ERR_INVALID_URL]: Invalid URL
39 verbose stack at new NodeError (node:internal/errors:371:5)
39 verbose stack at onParseError (node:internal/url:552:9)
39 verbose stack at new URL (node:internal/url:628:5)
39 verbose stack at getProxyUri (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\lib\agent.js:147:53)
39 verbose stack at getAgent (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\lib\agent.js:20:17)
39 verbose stack at remoteFetch (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\lib\remote.js:31:17)
39 verbose stack at cacheFetch (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\lib\cache\index.js:15:28)
39 verbose stack at async fetch (C:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\lib\fetch.js:82:7)
39 verbose stack at async Arborist.[nodeFromEdge] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1061:19)
39 verbose stack at async Arborist.[buildDepStep] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:930:11)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With