npm error code ERR_INVALID_URL #169704
-
Select Topic AreaQuestion Bodynpm error code ERR_INVALID_URL How can i solve this? Please help me |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
ERR_INVALID_URL in npm usually happens when npm tries to parse an invalid URL from configs or the lock file (most often: registry, proxy/https-proxy, or a broken link in package-lock.json). Quick checks (Windows PowerShell) 2Reset proxy settings (if they are set or broken) 3Clear lock file and cache, reinstall If that doesn’t help If you use a private registry (Azure Artifacts/GitHub Packages), make sure the URL is correct and/or set it with @scope:registry=https://…. Search package-lock.json for broken URLs: URLs like http:/... (with only one slash) or empty strings are a red flag — delete the lock file and reinstall (npm i). |
Beta Was this translation helpful? Give feedback.
-
That error usually means your npm registry URL is broken. bash bash |
Beta Was this translation helpful? Give feedback.
-
That Here’s how you can troubleshoot step by step: 1️⃣ Check your npm registry and config npm config get registry Expected output:
If it’s anything else (or looks incomplete), reset it: npm config set registry https://registry.npmjs.org/ Also check all your config values for stray URLs: npm config list If you see anything suspicious (like a file path or incomplete URL in place of a URL), correct or remove it with: npm config delete <key> 2️⃣ Check your
Open each
Make sure they’re complete URLs (start with 3️⃣ Clear npm cache npm cache clean --force 4️⃣ Check your install command npm install <something> Make sure the
if
5️⃣ If behind a proxy npm config get proxy
npm config get https-proxy If they show something invalid (empty or missing npm config delete proxy
npm config delete https-proxy |
Beta Was this translation helpful? Give feedback.
-
Thank You all of you Go to Advanced → Environment Variables. In both User variables and System variables, look for: HTTP_PROXY HTTPS_PROXY Select each one → click Delete → OK. Close and reopen your terminal/VS Code. |
Beta Was this translation helpful? Give feedback.
Thank You all of you
The error was that i was mistakenly set HTTP_PROXY and HTTPS_PROXY to HTTP_PROXY=http://proxy-server:port
HTTPS_PROXY=http://proxy-server:port
To fix it I just remove both values from System Env
Here is Steps
Press Win + R → type sysdm.cpl → press Enter.
Go to Advanced → Environment Variables.
In both User variables and System variables, look for:
HTTP_PROXY
HTTPS_PROXY
Select each one → click Delete → OK.
Close and reopen your terminal/VS Code.