在create-react-app

时间:2018-10-23 01:15:08

标签: reactjs

我是React.js的新手。我遵循了https://github.com/facebook/create-react-app中的教程。在运行npm init react-app my-app时工作正常。但是运行npm start时出现错误。

详细错误消息: error

error

我尝试过https://stackoverflow.com/questions/39959900/npm-start-error-with-create-react-app。那对我不起作用。我还尝试将项目文件夹移动到上层目录,但仍然无法正常工作.....

有人可以修复它吗?

添加:package.json

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.5.2",
    "react-dom": "^16.5.2",
    "react-scripts": "2.0.5"
  },
  "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"
  ]
}

1 个答案:

答案 0 :(得分:0)

尝试npm install -g 更新npm

然后rm -rf node_modules删除现有模块

最后npm install安装新的项目依赖项