I have developed the React js web application using AWS Amplify. I get this error during the cloning process of the amplify build.
2020-02-17T05:40:19.634Z [INFO]: Resolving deltas: 96% (85/88)
2020-02-17T05:40:19.642Z [INFO]: Resolving deltas: 100% (88/88)
2020-02-17T05:40:19.644Z [INFO]: Resolving deltas: 100% (88/88), done.
2020-02-17T05:40:19.662Z [INFO]: # Switching to commit: 2891d42cdf67d009c8cb84ec42db471b5aaae537
2020-02-17T05:40:19.669Z [INFO]: Note: checking out '2891d42cdf67d009c8cb84ec42db471b5aaae537'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 2891d42 add bowen email
2020-02-17T05:40:19.669Z [INFO]: # Checking for Git submodules at: /codebuild/output/src577764799/src/morning-admin-panel/.gitmodules
2020-02-17T05:40:19.715Z [INFO]: # Retrieving cache...
2020-02-17T05:40:23.250Z [INFO]: # Extracting cache...
2020-02-17T05:40:33.333Z [INFO]: # Extraction completed
bool) [/root/.nvm/versions/node/v10.16.0/bin/node]
4: 0xafff44 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/root/.nvm/versions/node/v10.16.0/bin/node]
5: 0xef4152 [/root/.nvm/versions/node/v10.16.0/bin/node]
6: 0xef4258 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [/root/.nvm/versions/node/v10.16.0/bin/node]
7: 0xf00332 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/root/.nvm/versions/node/v10.16.0/bin/node]
8: 0xf00c64 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/root/.nvm/versions/node/v10.16.0/bin/node]
9: 0xf038d1 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/root/.nvm/versions/node/v10.16.0/bin/node]
10: 0xeccd54 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/root/.nvm/versions/node/v10.16.0/bin/node]
11: 0x116cede v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [/root/.nvm/versions/node/v10.16.0/bin/node]
12: 0x1ee0996dbe1d
2020-02-17T05:44:01.944Z [WARNING]: error Command failed with exit code 1.
2020-02-17T05:44:01.944Z [INFO]: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2020-02-17T05:44:01.950Z [ERROR]: !!! Build failed
2020-02-17T05:44:01.950Z [ERROR]: !!! Non-Zero Exit Code detected
2020-02-17T05:44:01.950Z [INFO]: # Starting environment caching...
2020-02-17T05:44:01.952Z [INFO]: # Uploading environment cache artifact...
2020-02-17T05:44:02.041Z [INFO]: # Environment caching completed
I'm using "react": "^16.12.0", "aws-amplify": "^2.2.0", and Nodejs v12.13.1
I noticed that in my development environment I was using Nodejs v12.13.1. But amplify used Node v10
# Use the standard Amazon Linux base, provided by ECR/KaOS
# It points to the standard shared Amazon Linux image, with a versioned tag.
FROM 137112412989.dkr.ecr.us-west-2.amazonaws.com/amazonlinux:2
MAINTAINER Amazon AWS
# Framework Versions
ENV VERSION_NODE_8=8.12.0
ENV VERSION_NODE_10=10.16.0
ENV VERSION_NODE_12=12
ENV VERSION_NODE_DEFAULT=$VERSION_NODE_10
ENV VERSION_RUBY_2_4=2.4.6
ENV VERSION_RUBY_2_6=2.6.3
ENV VERSION_BUNDLER=2.0.1
ENV VERSION_RUBY_DEFAULT=$VERSION_RUBY_2_4
ENV VERSION_HUGO=0.55.6
ENV VERSION_YARN=1.16.0
ENV VERSION_AMPLIFY=1.12.0
# UTF-8 Environment
ENV LANGUAGE en_US:en
ENV LANG=en_US.UTF-8
ENV LC_ALL en_US.UTF-8
## Install OS packages
RUN touch ~/.bashrc
I had to change the amplify.yml to change the Nodejs version.
version: 0.1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- nvm use 12
- yarn install
build:
commands:
- nvm use 12
- yarn run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*