Reactjs 部署到GCP后我无法启动React应用程序,因为缺少模块';eslint/lib/formatters/style';
我的React应用程序工作正常,但当我部署到Google云平台时,我在浏览器中遇到此错误 ./src/index.js模块生成失败:错误:找不到模块 “eslint/lib/formatters/style” 此错误发生在生成时,无法排除 我在谷歌上读过很多类似的答案,但运气不好 我已经尝试删除package-lock.json和node_模块,然后运行npm安装,这没有什么区别,但仍然会出现错误 这是我的package.jsonReactjs 部署到GCP后我无法启动React应用程序,因为缺少模块';eslint/lib/formatters/style';,reactjs,google-cloud-platform,build-error,Reactjs,Google Cloud Platform,Build Error,我的React应用程序工作正常,但当我部署到Google云平台时,我在浏览器中遇到此错误 ./src/index.js模块生成失败:错误:找不到模块 “eslint/lib/formatters/style” 此错误发生在生成时,无法排除 我在谷歌上读过很多类似的答案,但运气不好 我已经尝试删除package-lock.json和node_模块,然后运行npm安装,这没有什么区别,但仍然会出现错误 这是我的package.json { "name": "AspNetCoreReactRedu
{
"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)
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吗?好的,我这样做了,现在可以部署了