Reputation: 332
TL;DR: I can't tell why my React app is failing the build on AWS Amplify.
Hello! I am new to deploying with AWS Amplify and needed some help demystifying the below logs.
# 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 [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-09-14T02:09:16.275Z [INFO]: info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
2020-09-14T02:09:16.276Z [INFO]: info [email protected]: The platform "linux" is incompatible with this module.
2020-09-14T02:09:16.278Z [INFO]: info "[email protected]" 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 " > [email protected]" 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...
The only two error lines occur almost at the very end, but I cannot immediately identify why. The React site loads just fine on my local computer using yarn start
and I also don't see any failures locally with yarn build
. Any ideas?
Here's the gulpfile.js if it helps:
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;
});
Upvotes: 2
Views: 1756
Reputation: 6313
Modify your gulpfile to this. I just added an alias for a default
task.
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);
Upvotes: 5