繁体   English   中英

由于缺少模块“eslint/lib/formatters/stylish”,我无法在部署到 GCP 后启动 React 应用程序

[英]I cant start React app after deploy to GCP because of missing module 'eslint/lib/formatters/stylish'

我的 React 应用程序运行正常,但是当我部署到 Google Cloud Platform 时,我在浏览器中收到此错误

./src/index.js 模块构建失败:错误:找不到模块“eslint/lib/formatters/stylish”

此错误发生在构建期间,无法消除。

我已阅读这许多谷歌的答案像这样,但没有运气。

我试过删除 package-lock.json 和 node_modules 然后运行 ​​npm install,这没有区别仍然得到错误

这是我的 package.json

{
  "name": "AspNetCoreReactRedux",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.2.0",
    "@material-ui/icons": "^4.2.1",
    "bootstrap": "^4.1.3",
    "jquery": "3.3.1",
    "primereact": "3.1.2",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-redux": "^5.0.6",
    "react-router-bootstrap": "^0.24.4",
    "react-router-dom": "^4.2.2",
    "react-router-redux": "^5.0.0-alpha.8",
    "react-scripts": "^1.1.5",
    "reactstrap": "^6.3.0",
    "redux": "^3.7.2",
    "redux-thunk": "^2.2.0",
    "rimraf": "^2.6.2",
    "typeface-roboto": "0.0.54"
  },
  "devDependencies": {
    "ajv": "^6.0.0",
    "babel-eslint": "^7.2.3",
    "cross-env": "^5.2.0",
    "eslint": "^4.19.1",
    "eslint-config-react-app": "^2.1.0",
    "eslint-plugin-flowtype": "^2.50.3",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^5.1.1",
    "eslint-plugin-react": "^7.11.1"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "scripts": {
    "start": "rimraf ./build && react-scripts start",
    "build": "react-scripts build",
    "test": "cross-env CI=true react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "lint": "eslint ./src/"
  }
}

我认为 package.json 有问题,但不知道是什么

我读到我可以尝试:

如果你还没有弹出并看到这个问题:

Remove anything with the word eslint from package.json
Remove package-lock.json and yarn.lock
Remove node_modules
Run npm install (or yarn if you use it)

但是这样做安全吗,这不会删除 eslint 吗?

好的,我这样做了,现在我可以部署了

Remove anything with the word eslint from package.json
Remove package-lock.json and yarn.lock
Remove node_modules
Run npm install (or yarn if you use it)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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