Я запускаю свои сценарии сборки локально с помощью NPM, и они успешно завершаются.Тем не менее, я размещаю свой веб-сайт с AWS Amplify, принял настройки сборки по умолчанию в соответствии с их рекомендациями, но сборка всегда завершается неудачно во время сборки внешнего интерфейса.
Я прочитал документацию (https://aws.amazon.com/getting-started/tutorials/deploy-react-app-cicd-amplify/)
Вот мой скрипт сборки в 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"
'' ''
Вот файл сборки по умолчанию в AWS Amplify: '' ''
version: 0.1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
# IMPORTANT - Please verify your build output directory
baseDirectory: /
files:
- '**/*'
cache:
paths:
- node_modules/**/*
'' ''
Вот выходные данные процесса сборки Amplify FrontEnd:'' ''
# Starting phase: preBuild
# Executing command: npm ci
2019-05-12T10:10:02.664Z [INFO]: > pngquant-bin@3.1.1 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]: > optipng-bin@3.1.4 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]: > jpegtran-bin@3.2.0 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]: > gifsicle@3.0.4 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]: > fsevents@1.2.9 install /codebuild/output/src794671044/src/Project-Pico/node_modules/fsevents
> node install
2019-05-12T10:10:04.504Z [INFO]: > node-sass@4.12.0 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]: > node-sass@4.12.0 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]: > project-pico@1.0.0 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]: > project-pico@1.0.0 clean /codebuild/output/src794671044/src/Project-Pico
> rimraf dist
2019-05-12T10:10:06.342Z [INFO]: > project-pico@1.0.0 copyfonts /codebuild/output/src794671044/src/Project-Pico
> copyfiles -f node_modules/font-awesome/fonts/* dist/fonts
2019-05-12T10:10:06.657Z [INFO]: > project-pico@1.0.0 imagemin /codebuild/output/src794671044/src/Project-Pico
> imagemin img/* -o dist/img
....
Сборка AWS Amplify должна успешно завершиться, но она всегда завершается неудачей.