我正在尝试使用 AWS 管道构建我的项目,昨天一切正常,我昨天推送了更新,从那时起我的构建一直不成功。这是一个使用 docker 容器的 React 应用程序。
我尝试将代码恢复为之前成功构建的代码,但是它仍然无法构建。我在本地计算机上运行容器,一切运行正常。
这是失败时日志的一部分
Creating an optimized production build... Failed to compile.
./node_modules/@coreui/react/node_modules/reactstrap/es/DropdownToggle.js
Attempted import error: 'Reference' is not exported from 'react-popper'.
·[91mnpm·[0m·[91m ·[0m·[91mERR! code ELIFECYCLE
·[0m·[91mnpm ERR! errno·[0m·[91m 1
·[0m·[91mnpm ·[0m·[91mERR! [email protected] build:
react-scripts build
npm ERR! Exit status 1
·[0m·[91mnpm ERR!
·[0m·[91mnpm ERR! Failed at the [email protected] build script.
npm ·[0m·[91mERR! This is probably not a problem with npm. There is likely additional logging output above.
·[0m·[91m
·[0m·[91mnpm ERR! A complete log of this run can be found in:
npm ERR!·[0m·[91m /root/.npm/_logs/2019-08-03T02_48_42_802Z-debug.log
·[0mThe command '/bin/sh -c REACT_APP_STRIPE_PUBLISHABLE_KEY=$REACT_APP_STRIPE_PUBLISHABLE_KEY npm run build' returned a non-zero code: 1
make: *** [publish-app] Error 1
[Container] 2019/08/03 02:48:48 Command did not exit successfully make publish-app exit status 2
[Container] 2019/08/03 02:48:48 Phase complete: BUILD State: FAILED
[Container] 2019/08/03 02:48:48 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: make publish-app. Reason: exit status 2
"reactstrap": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/reactstrap/-/reactstrap-7.1.0.tgz",
"integrity": "sha512-wtc4RkgnGn1TsZ0AxOZ2OqT+b8YmCWZj/tErPujWLepxzlEEhveZGC+uDerdaHVSAzJUP2DTk605iper7hutQQ==",
"requires": {
"@babel/runtime": "^7.2.0",
"classnames": "^2.2.3",
"lodash.isfunction": "^3.0.9",
"lodash.isobject": "^3.0.2",
"lodash.tonumber": "^4.0.3",
"prop-types": "^15.5.8",
"react-lifecycles-compat": "^3.0.4",
"react-popper": "^0.10.4",
"react-transition-group": "^2.3.1"
}
},
"react-popper": {
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/react-popper/-/react-popper-0.10.4.tgz",
"integrity": "sha1-rypBXqIike3VBGeNev2opu4ylao=",
"requires": {
"popper.js": "^1.14.1",
"prop-types": "^15.6.1"
}
},
package.json
{
"name": "myReactProjecr",
"version": "0.1.0",
"private": true,
"dependencies": {
"@coreui/coreui": "^2.1.7",
"@coreui/coreui-plugin-chartjs-custom-tooltips": "^1.2.0",
"@coreui/icons": "0.3.0",
"@coreui/react": "^2.1.5",
"axios": "^0.18.0",
"body-parser": "^1.19.0",
"bootstrap": "^4.3.1",
"bootstrap-less": "^3.3.8",
"chart.js": "^2.7.3",
"classnames": "^2.2.6",
"cookie-parser": "~1.4.3",
"core-js": "^2.6.5",
"cors": "^2.8.5",
"debug": "~2.6.9",
"dotenv": "^8.0.0",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.10.0",
"exceljs": "^0.8.2",
"express": "~4.16.0",
"express-rate-limit": "^3.5.1",
"flag-icon-css": "^3.3.0",
"font-awesome": "^4.7.0",
"http": "0.0.0",
"http-errors": "~1.6.2",
"https": "^1.0.0",
"jade": "~1.11.0",
"jquery": "^3.4.1",
"jsonwebtoken": "^8.5.1",
"moment": "^2.24.0",
"morgan": "~1.9.0",
"node-sass": "^4.11.0",
"pg-promise": "^8.6.5",
"prop-types": "^15.7.2",
"ramda": "^0.26.1",
"react": "^16.8.4",
"react-apollo": "^2.5.6",
"react-app-polyfill": "^0.2.1",
"react-chartjs-2": "^2.7.4",
"react-cookie": "^4.0.0",
"react-dates": "^20.2.0",
"react-dom": "^16.8.4",
"react-js-pagination": "^3.0.2",
"react-loadable": "^5.5.0",
"react-redux": "^7.0.3",
"react-router-config": "^4.4.0-beta.6",
"react-router-dom": "^4.3.1",
"react-select": "^2.4.3",
"react-stripe-checkout": "^2.6.3",
"react-stripe-elements": "^3.0.0",
"react-test-renderer": "^16.8.4",
"reactstrap": "^7.1.0",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"request": "^2.88.0",
"sequelize": "^5.8.7",
"simple-line-icons": "^2.4.1",
"stripe": "^6.34.0",
"xlsx": "^0.11.19"
},
"devDependencies": {
"react-scripts": "2.1.5"
},
"scripts": {
"start": "react-scripts start",
"start:server": "node ./server/www",
"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"
]
}
}
最佳答案
我也有同样的问题。通过使用最新版本更新react-popper解决了这个问题
npm install react-popper
还有第二个与粉笔相关的错误。我也更新了
npm install chalk
希望对你有帮助
关于reactjs - 无法构建 react 项目AWS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57335205/