3
votes

I used create-react-app to generate an app.

create-react-app myapp

When I run yarn start or npm start I get this error:

react-scripts start

sh: react-scripts: command not found npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! [email protected] start: react-scripts start npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the [email protected] start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

When I run npm ls react:

[email protected] /Users/johnno/foosball 
└── [email protected]

react-scripts is present.

This is my package.json:

{
  "name": "myapp",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-redux": "^5.0.6",
    "react-router": "^4.2.0",
    "react-scripts": "1.0.17",
    "redux": "^3.7.2",
    "yarn": "^1.3.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

I tried the suggestions from this but to no avail. How can I fix this issue?

1
Can we see all the commands you ran? - Andrew Li
see above updated the question - bier hier
Which version of node are you using? Did you try sudo npm start? - Nandu Kalidindi
node version 5.0.3 - bier hier
sudo npm start makes no difference - bier hier

1 Answers

7
votes

i solved this by deleting

node_modules
yarn.lock
manifest_lock.json

and installed packages by

npm install

or

yarn