Npm install : FetchError: request to http://registry.npmjs.org/... failed, reason: read ECONNRESET - npm

Trying to install any node package using npm hangs for about 5 mins then gives a ECONNRESET network error. I have been using npm for other projects recently and it worked fine but now will not work for any project(Including clean npm init)
npm i ws
This is on a Raspberry pi 3 running on my home network with no proxy requirements. All other machines both linux and windows are working fine.
npm -v = 6.4.1
I have tried the following:
npm i ws This gives me the ECONNRESET error (See below)
Curl https://registry.npmjs.org/
& Curl https://registry.npmjs.org/ws
Both return the correct json response
Removing any proxy settings
npm config rm proxy
npm config rm https-proxy
npm config set registry http://registry.npmjs.org/
Restarting etc
Full Error log:
npm i ws --save --verbose
npm info it worked if it ends with ok
npm verb cli [ '/home/pi/.nvm/versions/node/v8.16.0/bin/node',
npm verb cli '/home/pi/.nvm/versions/node/v8.16.0/bin/npm',
npm verb cli 'i',
npm verb cli 'ws',
npm verb cli '--save',
npm verb cli '--verbose' ]
npm info using npm#6.4.1
npm info using node#v8.16.0
npm verb npm-session 0a9bedb5def7f4a1
npm timing stage:rollbackFailedOptional Completed in 6ms
npm timing stage:runTopLevelLifecycles Completed in 1146975ms
npm verb type system
npm verb stack FetchError: request to http://registry.npmjs.org/ws failed, reason: read ECONNRESET
npm verb stack at ClientRequest.req.on.err (/home/pi/.nvm/versions/node/v8.16.0/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)
npm verb stack at emitOne (events.js:116:13)
npm verb stack at ClientRequest.emit (events.js:211:7)
npm verb stack at Socket.socketErrorListener (_http_client.js:401:9)
npm verb stack at emitOne (events.js:116:13)
npm verb stack at Socket.emit (events.js:211:7)
npm verb stack at emitErrorNT (internal/streams/destroy.js:66:8)
npm verb stack at _combinedTickCallback (internal/process/next_tick.js:139:11)
npm verb stack at process._tickCallback (internal/process/next_tick.js:181:9)
npm verb cwd /home/pi/projects/picamera/node_server
npm verb Linux 4.19.37-v7+
npm verb argv "/home/pi/.nvm/versions/node/v8.16.0/bin/node" "/home/pi/.nvm/versions/node/v8.16.0/bin/npm" "i" "ws" "--save" "--verbose"
npm verb node v8.16.0
npm verb npm v6.4.1
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to http://registry.npmjs.org/ws 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 verb exit [ 1, true ]
npm timing npm Completed in 1148813ms
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2019-05-10T23_28_17_769Z-debug.log

First check following thing:
ping registry.npmjs.org
You will get to know the IP address from that like below:
PING registry.npmjs.org (104.16.20.35) 56(84) bytes of data.
Then
sudo vi /etc/hosts
104.16.20.35 registry.npmjs.org
Then try to do following
npm install

Related

Vue-cli : ERROR Error: command failed: npm install --loglevel error --legacy-peer-deps

When I try to create a new project (vue create my-project), I get this error:
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network 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:\npm-cache\_logs\2023-01-14T16_48_04_209Z-debug-0.log
**ERROR** Error: command failed: npm install --loglevel error --legacy-peer-deps
Error: command failed: npm install --loglevel error --legacy-peer-deps
at ChildProcess.<anonymous> (C:\Users\hp\AppData\Roaming\npm\node_modules\#vue\cli\lib\util\executeCommand.js:138:16)
at ChildProcess.emit (node:events:513:28)
at cp.emit (C:\Users\hp\AppData\Roaming\npm\node_modules\#vue\cli\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1098:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5)
I'm on PC / Windows 10, and updated vue/cli, node, and npm.
Persets: ([Vue 3] dart-sass, babel, router, vuex, unit-jest).
I updated vue/cli, node, npm, and yarn.
I search for a solution here, and tried these solutions:
npm cache clean --force
npm config set registry="http://registry.npmjs.org/"
vue config --set useTaobaoRegistry false
npm config set fetch-retry-mintimeout 20000 (This did't work).
npm config set fetch-retry-maxtimeout 120000 (This did't work).
But the error is still when creating a project.
After the Internet acceleration procedures, the packages were downloaded, but this error remained:
npm ERR! Invalid Version:
npm ERR! A complete log of this run can be found in:
npm ERR! C:\npm-cache_logs\2023-01-16T19_19_07_037Z-debug-0.log
ERROR Error: command failed: npm install --loglevel error --legacy-peer-deps
Error: command failed: npm install --loglevel error --legacy-peer-deps
at ChildProcess. (C:\Users\hp\AppData\Roaming\npm\node_modules#vue\cli\lib\util\executeCommand.js:138:16)
at ChildProcess.emit (node:events:513:28)
at cp.emit (C:\Users\hp\AppData\Roaming\npm\node_modules#vue\cli\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1098:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5)

Getting Bad Request (Http 400) when using npm dist-tag with Nexus 3.19.1-01

We are running Nexus OSS 3.19.1-01 (CentOS7 with OpenJdk 1.8.0_222-b10) with npm repository. Everything works fine except the npm dist-tag feature which should now work with version >3.19.
$ npm publish <pkg> --tag bla #--> works
$ npm install <pkg>#bla #--> works
$ npm dist-tag ls <pkg> #--> works
$ npm dist-tag rm --verbose #myscope/mypackage foo
npm info it worked if it ends with ok
npm verb cli [
npm verb cli '/usr/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'dist-tag',
npm verb cli 'rm',
npm verb cli '--verbose',
npm verb cli '#myscope/mypackage',
npm verb cli 'foo'
npm verb cli ]
npm info using npm#6.13.1
npm info using node#v12.13.0
npm verb npm-session 3b193197390df1cf
npm verb dist-tag del snapshot from #myscope/mypackage
npm http fetch GET 200 https://nexus.example.com/repository/npm-group/-/package/#myscope%2fmypackage/dist-tags 1396ms
npm http fetch DELETE 400 https://nexus.example.com/repository/npm-group/-/package/#myscope%2fmypackage/dist-tags/foo 9ms
npm verb stack Error: 400 Bad Request - DELETE https://nexus.example.com/repository/npm-group/-/package/#myscope%2fmypackage/dist-tags/foo
npm verb stack at /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:104:15
npm verb stack at processTicksAndRejections (internal/process/task_queues.js:93:5)
npm verb statusCode 400
npm verb pkgid #myscope/mypackage#latest
npm verb cwd /home/myname/path-to-code/mypackage/client
npm verb Linux 5.3.11-300.fc31.x86_64
npm verb argv "/usr/bin/node" "/usr/local/bin/npm" "dist-tag" "rm" "--verbose" "#myscope/mypackage" "foo"
npm verb node v12.13.0
npm verb npm v6.13.1
npm ERR! code E400
npm ERR! 400 Bad Request - DELETE https://nexus.example.com/repository/npm-group/-/package/#myscope%2fmypackage/dist-tags/foo
npm verb exit [ 1, true ]
npm timing npm Completed in 1730ms
npm ERR! A complete log of this run can be found in:
npm ERR! /home/myname/.npm/_logs/2019-11-20T13_02_41_234Z-debug.log
$ npm dist-tag add #myscope/mypackage#0.1.0 bar
# did not work, same error as above
No additional log messages in nexus log.
Any idea?
I'm afraid it won't work for you, because you're running your commands against npm group repository. Both npm dist-tag add and npm dist-tag rm work only for hosted repositories as of NXRM 3.19.1. However, npm dist-tag ls is supported by all types of repositories (since 3.19.0).

unable to install bower in windows 10 using npm

I am unable to install bower in windows 10 using npm.
The Error message I get is:
C:\WINDOWS\system32>npm install -g bower
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "bower"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT 74.122.238.10:8080
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 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! Please include the following file with any support request:
npm ERR! C:\WINDOWS\system32\npm-debug.log
What's wrong?
It looks like a network connection timed out.
Check your Internet connectivity and try the command again later.
If you are using a proxy for your internet, npm needs to be configured properly for that. See https://docs.npmjs.com/misc/config#proxy.

Facing issue in setting my first react-native project.

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "--save-exact" "react-native"
npm ERR! node v4.2.1
npm ERR! npm v3.10.6
npm ERR! code ECONNRESET
npm ERR! network tunneling socket could not be established, cause=getaddrinfo ENOTFOUND proxy proxy:8083
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 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! Please include the following file with any support request:
npm ERR! /Users/i816556/AwesomeProject/npm-debug.log
npm install --save --save-exact react-native failed
Probably you have some npm related issues. Check this question for more help.

react-native init AwesomeProject throws ETIMEDOUT error when its about to build react-native

I've been trying to init a new react-native project and always run into the same ETIMEDOUT error.
I've run "react-native init AwesomeProject --verbose" on Terminal
Here is my npm-debug.log: https://gist.github.com/danielweinmann/a3a05ec4c253b9ff0016
I've tried setting npm registry to registry.npmjs.org with both http and https on the URL.
I started testing on a Mountain Lion and then upgraded to El Capitan and continued to get the same result
It seems to install all dependencies correctly and successfuly make all afterAdd writes to package.json, but throws the error after an "unlock" verb that's executed after an "about to build".
Here's the last part of my terminal screen:
npm verb afterAdd /Users/danielweinmann/.npm/uglify-js/2.4.24/package/package.json written
npm verb about to build /Users/danielweinmann/projects/AwesomeProject/node_modules/react-native
npm verb unlock done using /Users/danielweinmann/.npm/_locks/react-native-b39cdeb3f4f93e0a.lock for /Users/danielweinmann/projects/AwesomeProject/node_modules/react-native
npm verb stack Error: connect ETIMEDOUT 23.235.46.162:443
npm verb stack at Object.exports._errnoException (util.js:856:11)
npm verb stack at exports._exceptionWithHostPort (util.js:879:20)
npm verb stack at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1062:14)
npm verb cwd /Users/danielweinmann/projects/AwesomeProject
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/Cellar/node/5.4.1/bin/node" "/usr/local/bin/npm" "install" "--verbose" "--save" "react-native"
npm ERR! node v5.4.1
npm ERR! npm v2.14.15
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT 23.235.46.162:443
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 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 verb exit [ 1, true ]
npm verb unbuild node_modules/react-native
npm info preuninstall react-native#0.18.0-rc
npm info uninstall react-native#0.18.0-rc
npm verb unbuild rmStuff react-native#0.18.0-rc from /Users/danielweinmann/projects/AwesomeProject/node_modules
npm verb gentlyRm vacuuming from /Users/danielweinmann/projects/AwesomeProject/node_modules/.bin/react-native up to /Users/danielweinmann/projects/AwesomeProject
npm info postuninstall react-native#0.18.0-rc
npm verb gentlyRm don't care about contents; nuking /Users/danielweinmann/projects/AwesomeProject/node_modules/react-native
npm ERR! Please include the following file with any support request:
npm ERR! /Users/danielweinmann/projects/AwesomeProject/npm-debug.log
`npm install --save react-native` failed
Does anyone know what's happening? Can anyone help me?
Thanks a lot!
In the end, it was a network issue, indeed. I solved it by routing my mobile phone's internet connection to my computer through wi-fi.
In my case I have to disable firewall on my belkin router. Related to https://github.com/npm/npm/issues/8293 not react-native specific