1
votes

I am currently learning React. I have done:

  • npm i -g create-react-app (sucessful)
  • create-react-app react-app (sucessful)
  • cd react-app
  • npm start (error above)

Output:

  • npm start \Git\cmd was unexpected .at this time.

  • npm ERR! code ELIFECYCLE

So, what I have tried by searching online:

  • npm cache clean --force
  • delete node_modules
  • delete package-lock.json
  • npm run clear
  • npm install

None solved. I have read that I should not installed globally but now that it is already instaled (?) can I rollback? I can't run npm i g create-react-app again. Thank you

Edit: Added screenshot https://i.ibb.co/mNKLskX/Capturar.png

2
Please post your package.json contents - Rohan Dhar
Also, what OS are you using? Might be a permission issue if you are on Linux - Rohan Dhar
{ "name": "react-app", "version": "0.1.0", "private": true, "dependencies": { "react": "^16.6.3", "react-dom": "^16.6.3", "react-scripts": "2.1.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ] } - António F. Aires
I'm using Windows - António F. Aires
I added a screenshot - António F. Aires

2 Answers

0
votes

with npm try init

npm init react-app my-app

or, try npx:

npx create-react-app my-app

cd my-app

npm start
0
votes

Have you tried to follow the steps from 'create-react-app'?

`To create a new app, you may choose one of the following methods:

npx

 npx create-react-app my-app

(npx comes with npm 5.2+ and higher, see instructions for older npm versions)

npm

npm init react-app my-app

npm init is available in npm 6+

Yarn

yarn create react-app my-app

yarn create is available in Yarn 0.25+`

To have more info: https://github.com/facebook/create-react-app