我正在尝试使用 Amazon 的 AWS Amplify 部署 React/Typescript 应用程序,但构建一直失败并返回错误,其中包含:“无法读取属性 .match of undefined”
我已经阅读了很多线程,但每个人都一直在建议同样愚蠢的“解决方案”来删除包锁。它不起作用,所以不推荐它。
我猜 CSS 有问题,但我不确定它到底是什么。以下是项目的依赖项:
"@craco/craco": "^6.1.1",
"@fortawesome/fontawesome-free": "^5.15.2",
"@material-ui/core": "^4.11.3",
"@popperjs/core": "^2.9.1",
"@tailwindcss/custom-forms": "^0.2.1",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^12.7.3",
"@types/d3-array": "^2.9.0",
"@types/d3-scale": "^3.2.2",
"@types/jest": "^26.0.20",
"@types/node": "^12.20.4",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.1",
"@types/react-map-gl": "^5.2.9",
"aws-amplify": "^3.3.25",
"aws-sdk": "^2.863.0",
"chart.js": "^2.9.4",
"d3-array": "^2.12.0",
"d3-scale": "^3.2.3",
"deck.gl": "^8.4.10",
"elasticsearch": "^16.7.2",
"gulp": "^4.0.2",
"gulp-append-prepend": "^1.0.8",
"http-aws-es": "^6.0.0",
"mapbox-gl": "^2.1.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-map-gl": "^6.1.10",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"typescript": "^4.2.2",
"web-vitals": "^1.1.0"
这是包含错误的日志块:
2021-03-28T15:00:54.828Z [INFO]: > ****app@0.1.0 build /codebuild/output/src407501471/src/****app
> craco build
2021-03-28T15:00:57.092Z [INFO]: Creating an optimized production build...
2021-03-28T15:02:42.696Z [INFO]: Failed to compile.
2021-03-28T15:02:42.698Z [INFO]: ./node_modules/@fortawesome/fontawesome-free/css/all.min.css
TypeError: Cannot read property 'match' of undefined
2021-03-28T15:02:42.754Z [WARNING]: npm
2021-03-28T15:02:42.754Z [WARNING]: ERR! code ELIFECYCLE
npm ERR! errno 1
2021-03-28T15:02:42.756Z [WARNING]: npm
2021-03-28T15:02:42.757Z [WARNING]: ERR! ****app@0.1.0 build: `craco build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ****app@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-28T15:02:42.762Z [WARNING]:
2021-03-28T15:02:42.763Z [WARNING]: npm ERR! A complete log of this run can be found ```