我在ReactJS中遇到NPM构建错误的问题。我检查了build文件夹中的index.html文件,这就是它的内容。我已将构建文件夹上载到用于静态站点的AWS S3,但存在此问题。我的index.html文件应该包含此代码,还是其他?
Html Webpack Plugin:
Error: Parse Error: <src="components/app.js" /> <body> <div id="root"></div> <script type="text/javascript" src="/static/js/main.83185361.js"> </script> </body> </html> - htmlparser.js:235 new HTMLParser [reactProject]/[html-minifier]/src/htmlparser.js:235:13 - htmlminifier.js:944 minify [reactProject]/[html-minifier]/src/htmlminifier.js:944:3 - htmlminifier.js:1297 exports.minify [reactProject]/[html-minifier]/src/htmlminifier.js:1297:10 - index.js:296 [reactProject]/[html-webpack-plugin]/index.js:296:16 - util.js:16 tryCatcher [reactProject]/[bluebird]/js/release/util.js:16:23 - promise.js:512 Promise._settlePromiseFromHandler [reactProject]/[bluebird]/js/release/promise.js:512:31 - promise.js:569 Promise._settlePromise [reactProject]/[bluebird]/js/release/promise.js:569:18 - promise.js:614 Promise._settlePromise0 [reactProject]/[bluebird]/js/release/promise.js:614:10 - promise.js:693 Promise._settlePromises [reactProject]/[bluebird]/js/release/promise.js:693:18 - async.js:133 Async._drainQueue [reactProject]/[bluebird]/js/release/async.js:133:16 - async.js:143 Async._drainQueues [reactProject]/[bluebird]/js/release/async.js:143:10 - async.js:17 Immediate.Async.drainQueues [reactProject]/[bluebird]/js/release/async.js:17:14 </pre>
Package.json file
"version": "0.1.0", "private": true, "proxy": { "/auth/facebook": { "target": "http://localhost:5000" }, "/api/*": { "target": "http://localhost:5000" } }, "dependencies": { "axios": "^0.18.0", "express": "^4.16.3", "imgix.js": "^3.3.2", "informed": "^1.7.4", "init": "^0.1.2", "lodash": "^4.17.10", "namor": "^1.0.1", "nodejs": "0.0.0", "react": "^16.2.0", "react-ga": "^2.5.3", "react-redux": "^5.0.7", "react-router-dom": "^4.2.2", "react-scripts": "^1.0.17", "react-table": "^6.8.0", "react-validation": "^3.0.7", "redux": "^4.0.0", "redux-form": "^7.4.2", "redux-thunk": "^2.3.0", "semantic-ui": "^2.2.13", "slick-carousel": "^1.8.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": " react-scripts test --env=jsdom", "eject": "react-scripts eject", "webpack": "webpack --mode production" }, "devDependencies": { "prettier": "1.13.4", "webpack-cli": "^3.1.0" }