I tried to create a React app. I used the command prompt but after the app was created when I tried to start the npm it gives me some errors.
I tried to create React apps in WebStorm, IntelliJ and Visual Studio Code / PowerShell as well but still gives the same set of errors.
This is the error I get:
I tried many things like cleaning the npm cache, reinstalling npm and node, upgrading npm to new versions, tried to upgrade react but nothing worked.
events.js:173
throw er; // Unhandled 'error' event
npm ERR! code ELIFECYCLE
npm ERR! errno 1
gives some errors :
events.js:173
throw er; // Unhandled 'error' event
^
but it should start the npm and giving the localhost 3000
sudo npm start
if you are in macOS or linuxnpm i -g create-react-app
create-react-app APPNAME
node_module
folder, package-lock.json
and run npm install
yarn
. Install Yarn
globally then run create-react-app myapp
again. This time it will use yarn. try to start dev server with yarn start
instead of npm start
.UPDATE
Also there can be have a problem with react-script
version. You can try to downgrade the react script,
create-react-app my-app
cd my-app
npm install [email protected]
npm start
Also, make sure you have this entry in your PATH
environment variable.
C:\Users\{user_name}\AppData\Roaming\npm
You have initialized the port twice. check your code .its code duplication.
app.listen(3000,function(){
console.log('we are on');
});
this has been written twice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With