I am running my build scripts locally with NPM and they complete successfully. However, I am hosting my website with AWS Amplify, have accepted the default build settings per their recommendation but the build always fails on the during the frontend build.

I've read through the documentation (https://aws.amazon.com/getting-started/tutorials/deploy-react-app-cicd-amplify/)

Here is my build script in package.json: ''''

 "scripts": {
    "start": "npm run watch:all",
    "test": "echo \"Error: no test specified\" && exit 1",
    "lite": "lite-server",
    "jshint": "jshint",
    "scss": "node-sass -o css/ css/",
    "watch:scss": "onchange \"css/*.scss\" -- npm run scss",
    "watch:all": "concurrently \"npm run watch:scss\" \"npm run lite\"",
    "clean": "rimraf dist",
    "copyfonts": "copyfiles -f node_modules/font-awesome/fonts/* dist/fonts",
    "imagemin": "imagemin img/* -o dist/img",
    "usemin": " usemin index.html -d dist --htmlmin -o dist/index.html &&  usemin photos.html -d dist --htmlmin -o dist/photos.html && usemin \"pico's picks\".html -d dist --htmlmin -o dist/\"pico's picks\".html && usemin about.html -d dist --htmlmin -o dist/about.html && usemin contact.html -d dist --htmlmin -o dist/contact.html",
    "build": "npm run clean && npm run copyfonts && npm run imagemin && npm run usemin"


Here is the default build file in AWS Amplify: ''''

version: 0.1
        - npm ci
        - npm run build
    # IMPORTANT - Please verify your build output directory
    baseDirectory: /
      - '**/*'
      - node_modules/**/*


Here is the output of the Amplify FrontEnd build process: ''''

               # Starting phase: preBuild
                                 # Executing command: npm ci
2019-05-12T10:10:02.664Z [INFO]: > [email protected] postinstall /codebuild/output/src794671044/src/Project-Pico/node_modules/pngquant-bin
                                 > node lib/install.js
2019-05-12T10:10:03.154Z [WARNING]: ✔ pngquant pre-build test passed successfully
2019-05-12T10:10:03.163Z [INFO]: > [email protected] postinstall /codebuild/output/src794671044/src/Project-Pico/node_modules/optipng-bin
                                 > node lib/install.js
2019-05-12T10:10:03.514Z [WARNING]: ✔ optipng pre-build test passed successfully
2019-05-12T10:10:03.514Z [WARNING]: 
2019-05-12T10:10:03.521Z [INFO]: > [email protected] postinstall /codebuild/output/src794671044/src/Project-Pico/node_modules/jpegtran-bin
                                 > node lib/install.js
2019-05-12T10:10:03.882Z [WARNING]: ✔ jpegtran pre-build test passed successfully
2019-05-12T10:10:03.883Z [WARNING]: 
2019-05-12T10:10:03.890Z [INFO]: > [email protected] postinstall /codebuild/output/src794671044/src/Project-Pico/node_modules/gifsicle
                                 > node lib/install.js
2019-05-12T10:10:04.265Z [WARNING]: ✔ gifsicle pre-build test passed successfully
2019-05-12T10:10:04.374Z [INFO]: > [email protected] install /codebuild/output/src794671044/src/Project-Pico/node_modules/fsevents
                                 > node install
2019-05-12T10:10:04.504Z [INFO]: > [email protected] install /codebuild/output/src794671044/src/Project-Pico/node_modules/node-sass
                                 > node scripts/install.js
2019-05-12T10:10:05.004Z [INFO]: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.12.0/linux-x64-57_binding.node
2019-05-12T10:10:05.343Z [INFO]: Download complete
2019-05-12T10:10:05.346Z [INFO]: Binary saved to /codebuild/output/src794671044/src/Project-Pico/node_modules/node-sass/vendor/linux-x64-57/binding.node
2019-05-12T10:10:05.371Z [INFO]: Caching binary to /root/.npm/node-sass/4.12.0/linux-x64-57_binding.node
2019-05-12T10:10:05.396Z [INFO]: > [email protected] postinstall /codebuild/output/src794671044/src/Project-Pico/node_modules/node-sass
                                 > node scripts/build.js
2019-05-12T10:10:05.526Z [INFO]: Binary found at /codebuild/output/src794671044/src/Project-Pico/node_modules/node-sass/vendor/linux-x64-57/binding.node
2019-05-12T10:10:05.527Z [INFO]: Testing binary
2019-05-12T10:10:05.623Z [INFO]: Binary is fine
2019-05-12T10:10:05.702Z [WARNING]: added 878 packages in 8.92s
2019-05-12T10:10:05.712Z [INFO]: # Completed phase: preBuild
                                 # Starting phase: build
2019-05-12T10:10:05.713Z [INFO]: # Executing command: npm run build
2019-05-12T10:10:05.901Z [INFO]: > [email protected] build /codebuild/output/src794671044/src/Project-Pico
                                 > npm run clean && npm run copyfonts && npm run imagemin && npm run usemin
2019-05-12T10:10:06.087Z [INFO]: > [email protected] clean /codebuild/output/src794671044/src/Project-Pico
                                 > rimraf dist
2019-05-12T10:10:06.342Z [INFO]: > [email protected] copyfonts /codebuild/output/src794671044/src/Project-Pico
                                 > copyfiles -f node_modules/font-awesome/fonts/* dist/fonts
2019-05-12T10:10:06.657Z [INFO]: > [email protected] imagemin /codebuild/output/src794671044/src/Project-Pico
                                 > imagemin img/* -o dist/img


The AWS Amplify build should complete successfully, but it always fails.

0 Answers