everything was working fine but yesterday when I try to create a new project using npx create-react-app appname OR try to run current project by installing dependencies ' npm i ' i face this error.
npm ERR! code ENETUNREACH
npm ERR! syscall connect
npm ERR! errno ENETUNREACH
npm ERR! request to https://registry.npmjs.org/body-parser failed, reason: connect ENETUNREACH 0.0.31.144:80
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\(.log file address)
What I tried:
Check your internet connection: working fine
clear cache and Retry the installation: I tried but not working same error
Firewall settings: I also enabled the public and private node.exe file from Windows Defender Firewall settings
remove your package-lock.json: remove your node-modules folder and your package-lock.json file and run a fresh npm install command.
reinstalling nodeJs: i just delete and reinstall nodejs 21.7.1 but no improvements
Check npm Configuration: using 'npm config list' and found https-proxy = "http://8080/" someone suggest me to try
npm config set proxy http://<proxy-host>:<proxy-port>then i use host=localhost and port=8080 by doing this i face errornpm ERR! code ECONNREFUSED npm ERR! errno ECONNREFUSED npm ERR! FetchError: request to https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz failed, reason: npm ERR! at ClientRequest.<anonymous> and further errors.so I just set it back to
npm config set https-proxy = http://8080/
Any ideas what's causing this and how to fix it?