gpt4 book ai didi

reactjs - AWS Amplify React Site 构建失败,原因不明

转载 作者:行者123 更新时间:2023-12-02 19:14:23 25 4
gpt4 key购买 nike

TL;DR:我不知道为什么我的 React 应用程序无法在 AWS Amplify 上构建。

您好!我刚开始使用 AWS Amplify 进行部署,需要一些帮助来揭开以下日志的神秘面纱。

                                 # Starting phase: preBuild
# Executing command: yarn install
2020-09-14T02:09:01.005Z [INFO]: yarn install v1.16.0
2020-09-14T02:09:01.102Z [INFO]: [1/4] Resolving packages...
2020-09-14T02:09:01.572Z [INFO]: [2/4] Fetching packages...
2020-09-14T02:09:16.267Z [INFO]: info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-09-14T02:09:16.275Z [INFO]: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-09-14T02:09:16.276Z [INFO]: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
2020-09-14T02:09:16.278Z [INFO]: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-09-14T02:09:16.284Z [INFO]: [3/4] Linking dependencies...
2020-09-14T02:09:16.286Z [WARNING]: warning " > react-bootstrap-switch@15.5.3" has unmet peer dependency "prop-types@^15.5.0".
2020-09-14T02:09:23.129Z [INFO]: [4/4] Building fresh packages...
2020-09-14T02:09:25.051Z [INFO]: Done in 24.05s.
2020-09-14T02:09:25.072Z [INFO]: # Completed phase: preBuild
2020-09-14T02:09:25.073Z [INFO]: # Starting phase: build
# Executing command: yarn run build
2020-09-14T02:09:25.229Z [INFO]: yarn run v1.16.0
2020-09-14T02:09:25.257Z [INFO]: $ react-scripts build && gulp licenses
2020-09-14T02:09:26.114Z [INFO]: Creating an optimized production build...
2020-09-14T02:09:40.526Z [INFO]: Compiled successfully.
2020-09-14T02:09:40.527Z [INFO]: File sizes after gzip:
2020-09-14T02:09:40.550Z [INFO]: 57.07 KB build/static/js/2.57db696b.chunk.js
2020-09-14T02:09:40.552Z [INFO]: 46.8 KB build/static/css/main.b7a04f59.chunk.css
5.82 KB build/static/js/main.34e0f1c3.chunk.js
779 B build/static/js/runtime-main.58837106.js
The project was built assuming it is hosted at ./.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
Find out more about deployment here:
bit.ly/CRA-deploy
2020-09-14T02:09:40.864Z [INFO]: [02:09:40]
2020-09-14T02:09:40.864Z [INFO]: Using gulpfile /codebuild/output/src019925290/src/harsh_electronics_site/gulpfile.js
2020-09-14T02:09:40.865Z [INFO]: [02:09:40]
2020-09-14T02:09:40.866Z [INFO]: Starting 'licenses'...
2020-09-14T02:09:40.876Z [INFO]: [02:09:40]
2020-09-14T02:09:40.876Z [INFO]: Finished 'licenses' after 10 ms
2020-09-14T02:09:40.903Z [INFO]: Done in 15.68s.
2020-09-14T02:09:40.907Z [INFO]: # Executing command: node ./node_modules/gulp/bin/gulp.js
2020-09-14T02:09:41.148Z [INFO]: [02:09:41]
2020-09-14T02:09:41.149Z [INFO]: Using gulpfile /codebuild/output/src019925290/src/harsh_electronics_site/gulpfile.js
2020-09-14T02:09:41.149Z [WARNING]: [02:09:41]
2020-09-14T02:09:41.149Z [WARNING]: Task never defined: default
[02:09:41] To list available tasks, try running: gulp --tasks
2020-09-14T02:09:41.153Z [ERROR]: !!! Build failed
2020-09-14T02:09:41.153Z [ERROR]: !!! Non-Zero Exit Code detected
2020-09-14T02:09:41.154Z [INFO]: # Starting environment caching...
2020-09-14T02:09:41.154Z [INFO]: # Environment caching completed
Terminating logging...

仅有的两条错误线几乎出现在最后,但我无法立即确定原因。使用 yarn start,React 站点在我的本地计算机上加载得很好,而且我也没有在本地使用 yarn build 看到任何失败。有什么想法吗?

如果有帮助,这里是 gulpfile.js:

const gulp = require("gulp");
const gap = require("gulp-append-prepend");

gulp.task("licenses", async function () {
// this is to add Creative Tim licenses in the production mode for the minified js
gulp
.src("build/static/js/*chunk.js", { base: "./" })
.pipe(
gap.prependText(`/*!

=========================================================
* Paper Kit React - v1.2.0
=========================================================

* Product Page: https://www.creative-tim.com/product/paper-kit-react
* Copyright 2020 Creative Tim (http://www.creative-tim.com)

* Coded by HarshElectronics

=========================================================

* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

*/`)
)
.pipe(gulp.dest("./", { overwrite: true }));

// this is to add Creative Tim licenses in the production mode for the minified html
gulp
.src("build/index.html", { base: "./" })
.pipe(
gap.prependText(`<!--

=========================================================
* Paper Kit React - v1.2.0
=========================================================

* Product Page: https://www.creative-tim.com/product/paper-kit-react
* Copyright 2020 Creative Tim (http://www.creative-tim.com)

* Coded by HarshElectronics

=========================================================

* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

-->`)
)
.pipe(gulp.dest("./", { overwrite: true }));

// this is to add Creative Tim licenses in the production mode for the minified css
gulp
.src("build/static/css/*chunk.css", { base: "./" })
.pipe(
gap.prependText(`/*!

=========================================================
* Paper Kit React - v1.2.0
=========================================================

* Product Page: https://www.creative-tim.com/product/paper-kit-react
* Copyright 2020 Creative Tim (http://www.creative-tim.com)

* Coded by HarshElectronics

=========================================================

* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

*/`)
)
.pipe(gulp.dest("./", { overwrite: true }));
return;
});

最佳答案

将您的 gulpfile 修改为此。我刚刚为 default 任务添加了一个别名。

const gulp = require("gulp");
const gap = require("gulp-append-prepend");

async function license() {
// this is to add Creative Tim licenses in the production mode for the minified js
gulp
.src("build/static/js/*chunk.js", { base: "./" })
.pipe(
gap.prependText(`/*!

=========================================================
* Paper Kit React - v1.2.0
=========================================================

* Product Page: https://www.creative-tim.com/product/paper-kit-react
* Copyright 2020 Creative Tim (http://www.creative-tim.com)

* Coded by HarshElectronics

=========================================================

* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

*/`)
)
.pipe(gulp.dest("./", { overwrite: true }));

// this is to add Creative Tim licenses in the production mode for the minified html
gulp
.src("build/index.html", { base: "./" })
.pipe(
gap.prependText(`<!--

=========================================================
* Paper Kit React - v1.2.0
=========================================================

* Product Page: https://www.creative-tim.com/product/paper-kit-react
* Copyright 2020 Creative Tim (http://www.creative-tim.com)

* Coded by HarshElectronics

=========================================================

* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

-->`)
)
.pipe(gulp.dest("./", { overwrite: true }));

// this is to add Creative Tim licenses in the production mode for the minified css
gulp
.src("build/static/css/*chunk.css", { base: "./" })
.pipe(
gap.prependText(`/*!

=========================================================
* Paper Kit React - v1.2.0
=========================================================

* Product Page: https://www.creative-tim.com/product/paper-kit-react
* Copyright 2020 Creative Tim (http://www.creative-tim.com)

* Coded by HarshElectronics

=========================================================

* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

*/`)
)
.pipe(gulp.dest("./", { overwrite: true }));
return;
}

gulp.task("licenses", license);
gulp.task("default", license);

关于reactjs - AWS Amplify React Site 构建失败,原因不明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63877308/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com