我该如何解决错误的反应脚本启动。导入ml5后,反应npm start会收到此错误

时间:2020-01-26 08:26:58

标签: node.js reactjs p5.js

我的项目(包括p5.js)运行良好,我安装了ml5,并且我的项目运行良好,然后在组件中导入ml5.js时出现以下错误。 我该如何解决该错误?

npm ERR! e-posture@0.1.0 start: `react-scripts start`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the e-posture@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!     C:\Users\alishahi\AppData\Roaming\npm-cache\_logs\2020-01-26T07_54_07_158Z-debug.log

我搜索了一下,发现我的react-scripts版本可能不兼容,但是我不知道如何解决。这是我的package.json文件:

{
  "name": "e-posture",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.8.3",
    "@material-ui/icons": "^4.5.1",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.4.0",
    "@testing-library/user-event": "^7.2.1",
    "bootstrap": "^4.4.1",
    "ml5": "^0.4.3",
    "node-sass": "^4.13.1",
    "p5": "^0.10.2",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.3.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"
    ]
  }
}

1 个答案:

答案 0 :(得分:0)

我通过两个步骤解决了这个问题: 1)删除ml5@0.4.3并安装ml5@0.3.1 2)在omponent中的p5之前导入ml5 只是这些!!!