While starting the server for the first time just after the code checkout , my react js project is throwing error \"events.js:187 throw er; // Unhandled \'error\'
Make sure all the global & local packages that are being used in the scripts are installed, I've spent hours debugging an issue while deploying an application because webpack-cli & yarn
wasn't installed globally & my project was trying to access it locally.
You can use node Your_File_Name.js
command to run from the localhost. To use npm start command, you need to use scripts array in your package.json file
"scripts": { "start": "http://localhost:3000/" }
If this is not helpful can you attach more details?
Try this if none of the above answers solved u.. Go to My Computer>Properties>Advanced and in the environment variables Edit the PATH and add the following
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem; C:\Program Files\nodejs;C:\Users{yourName}\AppData\Roaming\npm
Add 4 of them and restart your PC
In your package.json file try lowering the version of "react-scripts" to "2.1.8":
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^7.2.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "2.1.8"
},
Above works for me.
If you are experiencing this error on ubuntu simply prepend "sudo" to the npm start command. That is sudo npm start
Downgrading the react-script
version from 3.0.1 to 2.1.8 worked for me.
Follow the following commands in sequence:-
npm install react-scripts@2.1.8
npm install
npm start