简体   繁体   中英

how to fix this npm start not working ( after npx create-react-app )

 npm ERR. code ELIFECYCLE npm ERR. errno 1 npm ERR: todos-clone-app@0.1.0 start. `react-scripts start` npm ERR. Exit status 1 npm ERR. npm ERR: Failed at the todos-clone-app@0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /home/josh/.npm/_logs/2020-08-21T19_28_35_521Z-debug.log

Edit:

package.json

{
  "name": "todos-clone-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.3",
    "webpack-dev-server": "^3.11.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [ ">0.2%", "not dead", "not op_mini all" ],
    "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ]
  }
}

Try deleting your node_modules directory and package-lock.json file. Then run npm install .

In my case, it was because of not being in the right folder.

Generally, I create a folder and go to Vs code to open it for typing create-react-app "folder name" to the console.

The problem was I was trying to npm start in parent folder instead of "folder name".

all you have to do is
1-cd folder name
2-npm start.

It should work.

try=> npx create-react-app./ it worked for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM