【问题标题】:how to fix this npm start not working ( after npx create-react-app )如何修复此 npm start 不起作用(在 npx create-react-app 之后)
【发布时间】:2020-12-10 11:18:54
【问题描述】:
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

编辑:

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" ]
  }
}

【问题讨论】:

    标签: node.js reactjs npm command


    【解决方案1】:

    尝试删除您的node_modules 目录和package-lock.json 文件。然后运行npm install

    【讨论】:

    • 分享/home/josh/.npm/_logs/ 目录的最新日志
    • /home/josh/.npm/_logs/2020-08-21T20_00_59_578Z-debug.log 这个?
    • 是的,如果这是最新的。您可以在 unix 中使用 ls -lhrt 的目录中找到最新文件。列表中的最后一个文件是最新的。
    • total 0 drwxrwxrwx 1 josh josh 512 Aug 21 13:04
    • cd /home/josh/.npm/_logs/ ls -lhrt 使用 vi 或更少打开最后一个文件,将文件中的所有内容复制并粘贴到此处。如果内容较多,删除文件,运行npm start,等到报错,再按照上面的说明操作。
    【解决方案2】:

    就我而言,这是因为不在正确的文件夹中。

    一般情况下,我会创建一个文件夹,然后转到 Vs 代码打开它,以便在控制台中输入create-react-app "folder name"

    问题是我试图在父文件夹中 npm start 而不是“文件夹名称”。

    你所要做的就是:

    1. cd folder_name
    2. npm start

    【讨论】:

      【解决方案3】:

      试试:

      npx create-react-app ./
      

      它对我有用。

      【讨论】:

        猜你喜欢
        • 2021-01-03
        • 2021-09-26
        • 2020-11-17
        • 2021-03-05
        • 2019-03-18
        • 2023-03-28
        • 2021-06-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多