windows: npm install getting error ERR! code ECONNRESET - node.js

I try to install ionic, but when run npm install -g ionic I have error below.
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! code ECONNRESET
npm ERR! network socket hang up
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
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'
My network don't have proxy, and when i run npm get proxy it said null
I already try to clean cache, and change registry to http://registry.npmjs.org/ and https://registry.npmjs.org/ and also I can access http://registry.npmjs.org/yo, but still have same error when installing ionic.
hope any solution for my issue.
Thank you,

There is some dependency problem.
see below link :
http://ionicframework.com/docs/concepts/development.html
Improved answer Below :
By default, brew install latest stable version of node (in this case 0.12.4). Based on the warning messages, ionic is expecting a lower version of node.
I was able to to solve this issue by installing a prior version of node (0.10.38).
$ brew remove node
$ rm ~/.node (might want to rename instead)
$ brew install homebrew/versions/node010
$ node --version
$ v0.10.38
Run npm install -g ionic worked as expected.

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 while trying to create react app using npm

I'm trying to creating react app using create-react-app command but I get this error message:
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/dotenv-expand: 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\IMAD\AppData\Local\npm-cache\_logs\2022-02-12T18_27_46_293Z-debug-0.log
I tried to clean cache:
npm cache clean -f
I also tried restarting the computer and reinstall nodejs and npm, but nothing was fixed.
Can anyone know what is the issue? and how can I solve it?
You should use npx command (not npm) like that as in official documentation : https://reactjs.org/docs/create-a-new-react-app.html
npx create-react-app my-app
After more than 3 days of working on this error, I found the solution and fixed the problem by install another version of Nodejs.
The current version was v16.14.0 when I got this error. And now it's v16.0.0 and everything's is work just fine.
New versions of nodejs are not stable, downgrade to 16.0.0 was the better thing i made.
I solved this using the following command.
npm uninstall -g create-react-app
then
npm install -g create-react-app

Is there a way to solve ECONNRESET error when using npm? I need to restart the machine to fix it

After using the computer for a while I cant use npm install anymore. If I restart the computer then all gets back to working.
I am using macOS Mojave 10.14.3 with node v11.12.0 and npm 6.9.0.
Tried the solutions here: npm not working - "read ECONNRESET" but no success
npm i faker
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/faker 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/flaviomelo/.npm/_logs/2019-03-28T12_25_35_242Z-debug.log
It is always possible that for a few minutes, NPM was down - so try again now just in case.
But in general, I would start by trying to find where the problem lies.
Try this:
curl https://registry.npmjs.org/faker
That should produce pages and pages of JSON. If it doesn't, then it's possible that your terminal - for whatever reason - cannot access the internet. Comments below this answer have further steps you can try in debugging this.
If it does produce lots of JSON, then there is a problem in your version of NPM / node. As these seem to be the latest, try downgrading each to see if it's a new bug.
you can try these solutions
Solution 1:
MAC + LINUX
run this command with sudo
sudo npm install -g yo
Windows
run cmd as administrator and then run this command again
Solution 2:
run this command and then try
npm config set registry http://registry.npmjs.org/

Unable to install electron from npm

I am trying to install electron on my ubuntu 16.04, i already have a working nodejs and npm. But suddenly I am unable to install modules by type:
sudo npm install electron
Below is the response am getting:
npm WARN registry Unexpected warning for https://registry.npmjs.org/:
Miscellaneous Warning EAI_AGAIN: request to
https://registry.npmjs.org/electron failed, reason: getaddrinfo
EAI_AGAIN registry.npmjs.org:443
npm WARN registry Using stale package data from
https://registry.npmjs.org/ due to a request error during
revalidation.
> electron#1.7.10 postinstall
/home/arthur/Documents/Programming/Electron/node_modules/electron
> node install.js
`/home/arthur/Documents/Programming/Electron/node_modules/electron/
install.js:48
throw err
^
Error: read ECONNRESET
at _errnoException (util.js:1024:11)
at TLSWrap.onread (net.js:615:25)
npm WARN y#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron#1.7.10 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron#1.7.10 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/arthur/.npm/_logs/2017-12-19T10_25_52_312Z-
debug.log
The issue is related to proxy configuration. Based on this answer, you can try the following.
First, try to remove if there exists your initial config:
npm config rm proxy
npm config rm https-proxy
And optionally if needed, try to set your proxy config
npm config set proxy proxy-url
npm config set https-proxy proxy-url
I tried everything but it seems I was using CENTOS which allowing me to install electron. I got help from FlashJonas: and tried installing electron again and it was installed as expected.
sudo npm install electron -g --verbose --unsafe-perm=true
Removing the proxy and https-proxy worked for me, just in case there is another person with a similar situation.
just enter the following in your terminal:
npm config rm proxy
npm config rm https-proxy
Do Any of the following. It Work for me.
Change Internet Connection.
Delete all electron file and then install npm insatll electron.
Try to install old version of electron.
This Error is because it can't able to download "electron-v11.2.1-win32-x64.zip" file. So Change Internet Connection it work for me.
I am behind a corporate proxy and had similar issues. None of the options above helped. In the end, I followed the instructions below to reconstruct the electron cache manually, so that it will not have to hit the network to download the binaries:
https://www.electronjs.org/docs/v14-x-y/tutorial/installation#custom-mirrors-and-caches
Basically I used a personal laptop (i.e. not behind the proxy) to install the latest electron on some test app, and then copied the %LOCALAPPDATA%\electron\Cache folder from my personal to the corporate laptop. Everything worked fine.

How to install node packages in ubuntu server with IPv6 only

I'm trying to install typescript on an Ubuntu server where only IPv6 address space is available.
I'm getting error as follows. Any help?
:/home/dev/.nvm# npm install --global typescript
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/typescript failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
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! /root/.npm/_logs/2017-11-01T19_15_39_294Z-debug.log
The error of this network connectivity happens with many packages and even github. I installed nvm in a slightly different way by setting the codebase in bitbucket.
I tried to install npm and n to setup typescript using n. That failed and I started using nvm as alternative. PFB the logs when trying to install n.
:~# sudo npm install -g n
npm ERR! Linux 4.4.0-98-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "n"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ENETUNREACH
npm ERR! errno ENETUNREACH
npm ERR! syscall connect
npm ERR! connect ENETUNREACH ::ffff:151.101.208.162:80 - Local (:::0)
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /root/npm-debug.log
I just need some way to get it installed but no luck! I strongly believe it is IPv6 issue and looking for work around.
Btw, my ubuuntu server is 16.04.3 LTS. I have installed it successfully on IPv4 servers running on Ubuntu 16.10 and 17.04 version and here in Production, I'm locked!
I got that working after a change in registry. Could be a network problem that I faced on server OR the IPv6 only issue. Anyway the change in registry worked perfect.
sudo npm --registry http://registry.node-modules.io/ install n -g
After all the link below guided me to the answer.
Node-modules.io
Hope this will help somebody for the future reference!
Thanks for #Kalana Demel for the help to reach me to the answer.
Another workaround which will also work for yarn, is to add the resolved ip6s to /etc/hosts :
2606:4700::6810:1723 registry.yarnpkg.com
2606:4700::6810:1723 registry.npmjs.org
2606:4700::6810:ab63 yarnpkg.com
You can get the ip6s with nslookup registry.yarnpkg.com, nslookup ….
It seems the issue might be with proxy setting try using http instead of https, ipv6 issues seems to be resolved in the newer versions of npm as well.
npm config set registry http://registry.npmjs.org/
npm cache clean
Update
It seems that the issue which was supposed to be fixed in 8.5.0 is still there, so for IPV6 only networks npm is still not working even though Node is now passing the necessary flags, so till it's fixed you will have to find a workaround.
For more info : Node, NPM

Resources