Network error when trying to install styled components via npm - reactjs

Hi guys, I have am trying to get my environment set up. I have started a React project with
npx create-react-app PROJECTNAME
I am now looking into using Styled Components. However when I attempt to install it with npm using this command
npm i --save styled-components
I get this error:
npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/styled-components failed, reason: connect ETIMEDOUT 2606:4700::6810:1123: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! C:\Users\nicho\AppData\Local\npm-cache\_logs\2022-05-05T23_33_02_048Z-debug-0.log
I am not using a proxy and everything else is working fine with my network.

go to the react app directory by using these terminal command : cd PROJECTNAME

Related

npm ERR! code ERR_SOCKET_TIMEOUT on creating new React project when using npx create-react-app

I have tried npm clear cache but still whenever I try to run npx create-react-app, I get the following error (I have a good Internet Connection).
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'
The issue was the npm version, I was using. I have used multiple solutions but the solution that worked for me was updating the npm version.
For Windows
npm update -g
For Mac
sudo npm install -g npm

ERROR CREATING REACT APP WITH npx create-react-app

it won't let me install react because this error comes out
i am trying to install react 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/html-webpack-plugin: 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\Hector\AppData\Local\npm-cache\_logs\2022-02-08T01_35_21_593Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
I already tried clearing the cache
Try npx create-react-app client. The word client can be replaced with any word you would like to be the name of your folder.

Getting trouble to create a new react app

While I'm Tring to create a new react app I'm getting an error message below,
Installing packages. This might take a couple of minutes. Installing
react, react-dom, and react-scripts with cra-template...
npm ERR! code ECONNRESET npm ERR! errno ECONNRESET npm ERR! network
Invalid response body while trying to fetch
https://registry.npmjs.org/jest-resolve: aborted 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\Akhlak Hossain
Jim\AppData\Local\npm-cache_logs\2020-11-17T06_20_31_124Z-debug.log
Aborting installation. npm install --save --save-exact --loglevel
error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json Deleting new-react/ from
J:\learning_time_practices Done. npm ERR! code 1 npm ERR! path
J:\learning_time_practices npm ERR! command failed npm ERR! command
C:\Windows\system32\cmd.exe /d /s /c ""create-react-app" "new-react"
"--use-npm""
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\Akhlak Hossain
Jim\AppData\Local\npm-cache_logs\2020-11-17T06_20_31_497Z-debug.log
Can you try first this one npm config set registry http://registry.npmjs.org/? then try again to execute npx create-react-app [your_app_name]
There May be a problem with automatic proxy setup, try this out
go to settings> Network and Internet > Proxy
and then under Automatic proxy setup turn off Automatically detect settings on Windows. And then open a command prompt and type the following command.
npm uninstall -g create-react-app
It worked for me.
In my case, Antivirus was the culprit which was blocking some files at the time of npx operation. This helped my case

Error "rollbackFailedOptional" on create-react-app

I'm learning React. I got this 2 errors in the screenshots below (links) when running:
npm i -g create-react-app#1.5.2
Screenshots:
https://i.ibb.co/S7yszvz/Capture.png
https://i.ibb.co/4Y7LY6X/Capture2.png
The errors:
[..................] / rollbackFailedOptional: verb npm-session 8a15f24eef6f3714
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/create-react-app
failed, reason: connect ETIMEDOUT 10.21.30.247: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'
What I tried:
npm config rm proxy
npm config rm https-proxy
npm config set registry http://registry.npmjs.org/
npm config get https-proxy (returns null)
I'm hoping for some help so I can make progress. Thanks
I finally did it using my phone network (must have been the firewall), but then:
C:\UserXXXX\Desktop\js REACT>create-react-app react-app
Creating a new React app in C:\UserXXXX\\Desktop\js REACT\react-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/posix-character-
classes/-/posix-character-classes-0.1.1.tgz failed, reason: getaddrinfo ENOTFOUND
registry.npmjs.org registry.npmjs.org: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'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\UserXXXX\AppData\Roaming\npm-cache\_logs\2018-12-
11T10_28_30_314Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting react-app / from C:\UserXXXX\Desktop\js REACT
Done.
I was facing similar issue a while back with npx create-react-app my-app as well.
So I reinstalled NodeJs and then tried removing proxy set up from npm config by following commands:
npm init
npm config rm proxy
npm config rm https-proxy
and then try the command npm i -g create-react-app#X.X.X again.

React bootstrap not installing

I tried installing react bootstrap on my machine for my new project using this
npm install react-bootstrap --save
but i keep getting these errors
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/bootstrap failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org: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'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\OLAOSEBIKAN\AppData\Roaming\npm-cache\_logs\2018-05-22T20_05_27_792Z-debug.log
I have create-react-app working fine

Resources