npm ERR! code ECONNRESET when doing create-react-app - node.js

I'm at my wits' end as I keep hitting this error when I'm trying to create-react-app. I am not using any proxies (like company proxy etc), as this is on my personal desktop.
When I check the logs, there is nothing.
I have tried the following solutions:
tried using npm config set registry http://registry.npmjs.org/ (have also tried going to this site on the browser, and I am indeed able to access it)
tried the following commands to remove proxy:npm config rm proxy, npm config rm https-proxy, npm config delete proxy, npm config delete http-proxy, npm config delete https-proxy
tried npm uninstall -g create-react-app to update it
tried npm cache clean --force
installed yarn and used its create-react-app
Uninstalled Node and reinstalled Node
Updated to the latest version of npm
Launched the command prompt in admin mode
Disabled the "Automatically Detect Settings" in the Windows Proxy settings
Any help greatly appreciated!

Related

npm ERR! code ERR_SOCKET_TIMEOUT npm ERR! network Socket timeout

This the 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'
I have running: -npm cache clean --force
Deleted node_modules and lock-package.json and run npm install but still got me that error
Try this answer
or run npm i -g npm#8.5.1
i think it's an issue with npm version , 8.5.1 solves the problem in most cases
basically try earlier versions and i think the problem will be solved
I faced this error some days ago. I changed the timeout and it works for me. (Note: my npm version is 8.19.1)
You can try this solution with other npm versions as well.
First of all, check the current settings. For checking the current settings run npm config ls -l or grep fetch
Then, check these 4 values (fetch-retries, fetch-retry-factor, fetch-retry-maxtimeout, fetch-retry-mintimeout, fetch-timeout)
$ npm config ls -l | grep fetch
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
fetch-timeout = 300000
For changing the time out, Run these two commands-
npm config set fetch-retry-mintimeout 20000
npm config set fetch-retry-maxtimeout 120000
I faced this problem recently. I tried many solutions like npm cache verify, npm cache clean --force, npm config set fetch-retry-mintimeout, npm config set fetch-retry-maxtimeout, deleting package-lock.json, using different version of npm and/or node.
But the solution that worked for me was to switch to yarn.
I solved this by setting a timeout of 60000 for npm in the .npmrc file. To do that from your terminal, simply do the following:
$ nano .npmrc from your work directory if you want a configuration locally.
Add timeout=60000, save and you're good to go.
Originally posted here: https://github.com/facebook/create-react-app/issues/10251
You can resolve this using YARN package manager. yarn create react-app my-app
hope it help.
I am not sure if this will help anyone else, but what appears to have worked for me was dropping my company's VPN connection and reestablishing it!
In my scenario, it was the yarn.lock file availability. So the installer tried to fetch dependencies and threw an error since the response time was delayed. So deleted both yarn.lock and package.lock file and reinstalled after setting npm to npm#8.5.1
I found solution for it, which works great for me
1.npm config set registry http://registry.npmjs.org/
2.npm i or npm i --save --legacy-peer-deps
Try removing proxy settings by running the commands below:
$ npm config rm proxy
$ npm config rm https-proxy
mine worked using these steps, hope it works for you too.
npm cache clean --force
npm uninstall -g create-react-app
npm uninstall create-react-app
and then
npx create-react-app project-app
if it does not then probably your internet connection is poor or there is a proxy set up error. let me know if it does not work.

how to fix connect ENETUNREACH on npm on linux

i am not using a proxy im just a noob trying to learn how to develop with create-react-app locally on my machine(linux)
this is the output of tracepath registry.npmjs.org
1?: [LOCALHOST] 0.020ms pmtu 1500
1: 2001:4451:664:1400:caf6:c8ff:fef2:bdcb 2.906ms !N
1: 2001:4451:664:1400:caf6:c8ff:fef2:bdcb 0.995ms !N
Resume: pmtu 1500
i think this proves im not using a proxy.
but i keep getting this error
npm ERR! code ENETUNREACH
npm ERR! syscall connect
npm ERR! errno ENETUNREACH
for anything npm. i dont know what to do.
i have tried..
deleting the package.json in my home directory. deleting the
package-lock.json in my home directory. deleting the .npm directory
in my home direcory.
clearing the cache with the npm config command
setting https-proxy from the config to null setting proxy from the
config to null setting the registry to https://registry.npmjs.org
setting the registry to htpp://registry.npmjs.org uninstalled npm
and dependencies then reinstalled unintsalled npm and dependencies then installed nvm and reinstalled node through that
npm install --verbose doesnt say any error messages
please somebody help me, i try just about anything shy of reinstalling my os.
The issue is that node 18 (not happening on 16) is trying to resolve by ipv6 first.
Can override it by exporting the environment variable:
NODE_OPTIONS = "--dns-result-order=ipv4first"

Installing npm package fails with 404

Using the command prompt, I am trying to install angular CLI and it fails. I have npm version 5.5.1 and node version v8.9.1. I am trying to install angular cli using the command
npm install -g #angular/cli#latest
and it fails with the error:
npm ERR! code E404
npm ERR! 404 Not Found: #angular/cli#latest
npm ERR! A complete log of this run can be found in:
I look at the log file and I see its trying to fetch the package from a location that doesn't exist. Not sure from where it gets pulled. How do I fix this location path and install angular cli. Same happens when I try to install typescript or any other npm package. all of them try to install from the location mentioned below and it fails with 404
8 http fetch GET 404
http://nuget.feed.xyz.corp:8729/npm/FeedNPM/#angular%2fcli 109ms
9 silly fetchPackageMetaData error for #angular/cli#latest 404 Not Found:
#angular/cli#latest
10 verbose stack Error: 404 Not Found: #angular/cli#latest
npm config set registry http://registry.npmjs.org
NPM registry documentation
Try first this commands (in windows run as administrator)
npm config set registry http://registry.npmjs.org
npm install -g #angular/cli
if still not working let's update NPM and nodejs by running this commands
npm -g install npm
npm cache clean -f
npm install -g n
then try to run
npm install -g #angular/cli
This should solve this problem
in my case it was .npmrc file in my project dir, which kept overwriting my global registry url. As soon as I deleted it, I could finally use npm install
Add a .npmrc file in the root of the project. .npmrc will look like below -
#xy:registry=https://xyz.jfrog.io/xyz/api/npm/npm-local/
#xy-app:registry=https://xyz.jfrog.io/xyz/api/npm/npm-local/
And Delete all the field eg - email , auth etc.
Find out what is the registry url of your application and put it into the registry.
Then run command - npm install
And it will work.
It was giving the same error for me when I use office network/vpn as they have 'umbrella' DNS security shield. To solve this issue, connect to personal network and type the below commands:
npm config set registry http://registry.npmjs.org
npm install -g #angular/cli
Alternative, another option to avoid 404 npm error
check if your terminal is in the root directory, if not your npm scripts will not execute
because it will not be able to see the package.json
I had same problem with a private package.
Need to:
npm adduser
npm login
I spent hours on this.
I had to follow the below steps to get it to work (mac).
Delete my LOCAL (not project) .npmrc by running:
rm /Users/<NAME>/.npmrc
Then set the registry:
npm config set registry https://registry.npmjs.org/
Then follow the steps for logging in to npm:
npm login
Check what's in your config list by running:
npm config list
It should look like this:
//registry.npmjs.org/:_authToken = (protected)
registry = "https://registry.npmjs.org/"
Hope it works for you too.
change your access level to public. type this in the terminal
npm --access=public
install your angular.
sudo npm install #ngular/cli
In my case, that's a typo error:
change trct-js-sdk to trtc-js-sdk saved my life.
My solution was as follows because I had a dependency on a private package. If you see the dependency in package.json defined in the format #scope/package, then #scope tells you that it's a scoped package that might be private.
Get the private package owner to grant you access to the package
Upgrade npm
Upgrade node
Add registry using HTTPS (not HTTP), e.g. npm config set registry https://registry.npmjs.org
Do "npm login"
Now run the build
Uninstall NPM & nodejs and install the right way NPM (Ubuntu)
sudo with npm is not recommended
To Uninstall
sudo apt-get remove nodejs
sudo apt-get remove npm
or
sudo apt-get purge nodejs
Followed by proper installation
curl -o-
https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
To confirm open a new terminal run:
$ command -v nvm
Latest LTS release of NodeJS:
$ nvm install --lts
Set default environment
$ nvm alias default lts/*
Worked for me
I got
error 404 'dotnev#*' is not in this registry.
Deleted .npmrc file in 2 folders back over my project root
and then in the project root folder typed:
npm i dotenv
copied from:
https://www.npmjs.com/package/dotenv
Just run sudo npm config set registry http://registry.npmjs.org and then update your npm.
It is an network error , check your network connection and try to install it again.
the only command line "npm -g install npm" solved the issue for me!
the following link can be helpful to dig deep for a better understanding.
Thanks a lot.

npm5 does not accept proxy settings

I upgraded to latest npm 5 today and it started throwing me following error.
npm ERR! code E407
npm ERR! 407 Proxy Authorization Required: <node-module>
I have proxy setting configured in .npmrc file. Does NPM 5 maintain any other file for proxy setting?
I too was facing the same issue but I believe my issue was due to NTLM authentication as I was on windows (sigh!).
If you too are on windows, follow these steps:
Install fiddler
Open Fiddler -> Rules -> Automatically Authenticate
Change proxy and https-proxy of npm to "http://localhost:8888"
try running npm install now.
Note: You may need to change proxy settings of Git too.
I could fix it by deleting npm folder from AppData/
And then ran
npm cache clean
and reinstalled npm using
npm i -g npm#latest

"npm config set global false" not working

For some reason my npm is configured to install packages globally. I may have selected that option when I initially installed npm. However, I'm trying to change that configuration so npm installs locally. I googled and found this option:
npm config set global false
However, npm is still installing globally instead of locally. Am I missing a step or doing something incorrectly? Would you expect the command above to do what I need it to do?
npm installs packages locally by default. If you want to install a package globally use flag -g.
e.g. npm install my-package -g

Resources