NPM, downloads dependencies from wrong URL address - node.js

After working with some project, my npm started to download dependencies from wrong address globally:
npm install -g bower
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to http://172.168.1.1/bower failed, reason:
connect ETIMEDOUT 172.168.1.1
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
Is there some method to reset download address to default one?
I'm using Windows version of NodeJS

Looks like your registry npm config option points to the wrong location. It must be https://registry.npmjs.org, check it with the following command:
npm config get registry
If your registry is different, use this command to set it correctly:
npm config set registry https://registry.npmjs.org/

Related

getting error while installing npm packages in visual studio code

getting below error while installing npm package chalk in visual studio code
PS C:\sagar\node js training> npm install chalk
npm WARN config global --global, --local are deprecated. Use --location=global instead.
npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to http://registry.npmjs.org/chalk failed, reason: connect ETIMEDOUT 104.16.23.35:80
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
I've only gotten that error, when trying to install packages with a very bad internet connection.
I think the only solution is to wait for a better internet connection, and then try again.
I personally just tried to install the package using the 'npm install chalk' and I had no issues.

Error occurs when running npm install after creating VueJS project

I just installed VueJS and I tried creating a project. I followed their installation and quick start guide VueJS Getting Started.
> npm init vue#latest
> cd (My Project Name Here)
> npm install
However, after doing > npm install, it returns the following message in the VSCode Terminal:
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/lodash: Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\alscg\AppData\Local\npm-cache\_logs\2022-04-07T08_54_47_537Z-debug-0.log
How do I fix this? Am I doing this wrong?
Please try this link it looks like it is answered already
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)

I got this error while installing npm on my my angular project folder

Installing packages (npm)...npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/#babel%2fplugin-proposal-nullish-coalescing-operator: Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\faizan\AppData\Local\npm-cache_logs\2021-12-07T00_42_46_255Z-debug-0.log
× Package install failed, see above.
The Schematic workflow failed. See above.
This scenario sounds like you may have a slow internet connection.
I solved my this error like SS
in the following way:
Try increasing the timeout from 60s to 90s by adding this to your .npmrc file:
You need create .npmrc file if you do not have it
C:\Users{username}.npmrc (for Windows)
~/.npmrc (for Linux/Mac)
timeout=60000
And you could also try adding if you have a slow internet connection or want to save bandwidth
prefer-offline=true
Or you can create/update one in the same directory as the project's package.json file as well.

NPM issue on Mac

I had been using VS Code for my development works, when all of a sudden my npm install commands stopped working and started giving me errors like below:
⸨░░░░░░░░░░░░░░░░░░⸩ ⠧ rollbackFailedOptional: verb npm-session abcd123456789efg
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/passport failed, reason: read ECONNRESET
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ajaywadhwani/.npm/_logs/2019-01-27T22_33_38_087Z-debug.log
I am not behind any proxy by any chance.
Interestingly, a ping to the link https://registry.npmjs.org/passport through my browser takes me to the webpage with the content, and can ping the website through terminal.
Kindly advise and suggest.
Try updating to the latest npm with the command npm install npm#latest -g.
I would also make sure there's no proxy set up by going to System Preferences > Network > your connection (Wi-Fi, for example) > Advanced... > Proxies and looking for any checked boxes.
Please let me know if these solutions work or not.

error showing for angular cli installation

I am trying to install angular cli but it showing error .
the error is
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/#angular%2fcli failed, reason: getaddrinfo ENOTFOUND proxy.comviva.com proxy.comviva.com:8080
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\malaya.choudhury\AppData\Roaming\npm-cache\_logs\2018-12-03T07_09_20_267Z-debug.log
Please give me the solution.
Working answer from an already asked question:
In most cases you are behind a proxy or have bad network settings. First, run npm config list and check whether you are behind a proxy. If so, try running
npm config delete proxy
npm config delete http-proxy
npm config delete https-proxy
Link: https://stackoverflow.com/a/54512973/15291281

Resources