vishal singh
vishal singh

Reputation: 41

Npm “ENOTFOUND error” while installing ReactJs

I would like to install ReactJs. I have installed Nodejs then try to create ReactJs project folder, I use
npx create-react-app my-app as per ReactJs documentation But this is the error which I get:-

npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.11.0.tgz failed, reason: getaddrinfo ENOTFOUND proxy.company.com
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!     ..\_logs\2020-12-22T14_02_16_883Z-debug.log

Upvotes: 0

Views: 6915

Answers (4)

Chammi Hansana
Chammi Hansana

Reputation: 1

Use a different (Wi-Fi) network or a mobile hotspot. Then try again to create the react app:

npx create-react-app <project_name>

This works for me, hope it helps you.

Upvotes: 0

Terrance Khumalo
Terrance Khumalo

Reputation: 71

I was setting proxy as

npm config set http_proxy=http://domain:8080

instead of using the correct way

npm config set proxy http://domain:8080

e.g: npm config set proxy http://123.01.2.

If you're using windows you can find the domain address in the control panel> Network and internet >internet options > click connections tab > Lan settings. You should see your proxy address

Upvotes: 0

vishal singh
vishal singh

Reputation: 41

Go to

C:\Users\username

and then Search

.npmrc

Open .npmrc file with Notepad and Delete everything and past

http_proxy=http://domain:8080

This Works For me.

Upvotes: 1

Trott
Trott

Reputation: 70085

Based on this line in the error message:

npm ERR! network request to https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-3.11.0.tgz failed, reason: getaddrinfo ENOTFOUND proxy.company.com

...you have proxy.company.com set as your proxy somewhere. Find that and fix it to the setting you actually need or else remove it if you need no proxy (which is the standard/typical case). In the latter case, use npm config delete proxy and then try to install.

Perhaps you were following the instructions at https://jjasonclark.com/how-to-setup-node-behind-web-proxy/ or a related tutorial that uses proxy.company.com in its examples.

Upvotes: 0

Related Questions