简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM