aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
457 stars 115 forks source link

There is no nvm, node, npm and /root/.nvm/versions/node/VERSION_NODE_DEFAULT/bin directory when the frontend build phase #552

Closed iamssen closed 3 years ago

iamssen commented 4 years ago

This is my amplify.yml file.

version: 0.1
frontend:
  phases:
    preBuild:
      commands:
        - echo $PATH
        - which nvm
        - which node
        - which npm
        - npm install
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: dist/app/browser
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Always build failed with command not found message.

There is no nvm, node, npm at the frontend build phase.

I did not change any settings. it is the default setting.

This problem occurs very often.

                                 # Starting phase: preBuild
                                 # Executing command: echo /usr/local/rvm/gems/ruby-2.3.6/bin:/usr/local/rvm/gems/ruby-2.3.6@global/bin:/usr/local/rvm/rubies/ruby-2.3.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2020-04-01T01:32:08.253Z [INFO]: /usr/local/rvm/gems/ruby-2.3.6/bin:/usr/local/rvm/gems/ruby-2.3.6@global/bin:/usr/local/rvm/rubies/ruby-2.3.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
                                 # Executing command: which nvm
2020-04-01T01:32:08.253Z [WARNING]: which: no nvm in (/usr/local/rvm/gems/ruby-2.3.6/bin:/usr/local/rvm/gems/ruby-2.3.6@global/bin:/usr/local/rvm/rubies/ruby-2.3.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)
2020-04-01T01:32:08.254Z [ERROR]: !!! Build failed
2020-04-01T01:32:08.326Z [ERROR]: !!! Non-Zero Exit Code detected
2020-04-01T01:32:08.326Z [INFO]: # Starting environment caching...
2020-04-01T01:32:08.327Z [INFO]: # Environment caching completed
Terminating logging...
ganipcanot commented 4 years ago

@iamssen Can you try moving the preBuild commands down to build and see if it works?

iamssen commented 4 years ago

@ganipcanot It does not work.

Provision

# 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
RUN yum -y update && \
    yum -y install \
        alsa-lib-devel \
        autoconf \
        automake \
        bzip2 \
        bison \
        bzr \
        cmake \
        expect \
        fontconfig \
        git \
        gcc-c++ \
        GConf2-devel \
        gtk2-devel \
        gtk3-devel \
        libnotify-devel \
        libpng \
        libpng-devel \
        libffi-devel \
        libtool \
        libX11 \
        libXext \
        libxml2 \
        libxml2-devel \
        libXScrnSaver \
        libxslt \
        libxslt-devel \
        libyaml \
        libyaml-devel \
        nss-devel \
        openssl-devel \
        openssh-clients \
        patch \
        procps \
        python3 \
        python3-devel \
        readline-devel \
        sqlite-devel \
        tar \
        tree \
        unzip \
        wget \
        which \
        xorg-x11-server-Xvfb \
        zip \
        zlib \
        zlib-devel \
    yum clean all && \
    rm -rf /var/cache/yum

## Install Node 8 & 10 & 12
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
RUN curl -o- -L https://yarnpkg.com/install.sh > /usr/local/bin/yarn-install.sh
RUN /bin/bash -c ". ~/.nvm/nvm.sh && \
    nvm install $VERSION_NODE_8 && nvm use $VERSION_NODE_8 && \
    nvm install $VERSION_NODE_10 && nvm use $VERSION_NODE_10 && \
    npm install -g sm grunt-cli bower vuepress gatsby-cli && \
    bash /usr/local/bin/yarn-install.sh --version $VERSION_YARN && \
    nvm install $VERSION_NODE_12 && nvm use $VERSION_NODE_12 && \
    npm install -g sm grunt-cli bower vuepress gatsby-cli && \
    bash /usr/local/bin/yarn-install.sh --version $VERSION_YARN && \
    nvm alias default node && nvm cache clear"

## Install Ruby 2.4.x and 2.6.x
RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
    curl -sL https://get.rvm.io | bash -s -- --with-gems="bundler"

ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN /bin/bash --login -c "\
    rvm install $VERSION_RUBY_2_4 && rvm use $VERSION_RUBY_2_4 && gem install bundler -v $VERSION_BUNDLER && gem install jekyll && \
    rvm install $VERSION_RUBY_2_6 && rvm use $VERSION_RUBY_2_6 && gem install bundler -v $VERSION_BUNDLER && gem install jekyll && \
    rvm cleanup all"

## Install awscli
RUN /bin/bash -c "pip3 install awscli && rm -rf /var/cache/apk/*"

## Install SAM CLI
RUN /bin/bash -c "pip3 install aws-sam-cli"

## Install Hugo
RUN wget https://github.com/gohugoio/hugo/releases/download/v${VERSION_HUGO}/hugo_${VERSION_HUGO}_Linux-64bit.tar.gz && \
    tar -xf hugo_${VERSION_HUGO}_Linux-64bit.tar.gz hugo -C / && \
    mv /hugo /usr/bin/hugo && \
    rm -rf hugo_${VERSION_HUGO}_Linux-64bit.tar.gz

## Installing Cypress
RUN /bin/bash -c ". ~/.nvm/nvm.sh && \
    nvm use ${VERSION_NODE_DEFAULT} && \
    npm install -g --unsafe-perm=true --allow-root cypress"

## Install AWS Amplify CLI for VERSION_NODE_DEFAULT and VERSION_NODE_10
RUN /bin/bash -c ". ~/.nvm/nvm.sh && nvm use ${VERSION_NODE_DEFAULT} && \
    npm install -g @aws-amplify/cli@${VERSION_AMPLIFY}"
RUN /bin/bash -c ". ~/.nvm/nvm.sh && nvm use ${VERSION_NODE_10} && \
    npm install -g @aws-amplify/cli@${VERSION_AMPLIFY}"

## Environment Setup
RUN echo export PATH="\
/usr/local/rvm/gems/ruby-${VERSION_RUBY_DEFAULT}/bin:\
/usr/local/rvm/gems/ruby-${VERSION_RUBY_DEFAULT}@global/bin:\
/usr/local/rvm/rubies/ruby-${VERSION_RUBY_DEFAULT}/bin:\
/usr/local/rvm/bin:\
/root/.yarn/bin:\
/root/.config/yarn/global/node_modules/.bin:\
/root/.nvm/versions/node/${VERSION_NODE_DEFAULT}/bin:\
$(python3 -m site --user-base)/bin:\
$PATH" >> ~/.bashrc && \
    echo export GEM_PATH="/usr/local/rvm/gems/ruby-${VERSION_RUBY_DEFAULT}" >> ~/.bashrc && \
    echo "nvm use ${VERSION_NODE_DEFAULT} 1> /dev/null" >> ~/.bashrc

ENTRYPOINT [ "bash", "-c" ]

Cloning repository

2020-04-02T23:34:27.094Z [INFO]: Git SSH Key acquired
2020-04-02T23:34:27.178Z [INFO]: # Cloning repository: git@github.com:lunit-io/cxr-opt-frontend-2002-mgh.git
2020-04-02T23:34:27.284Z [INFO]: Agent pid 116
2020-04-02T23:34:27.335Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2020-04-02T23:34:27.546Z [INFO]: Cloning into 'cxr-opt-frontend-2002-mgh'...
2020-04-02T23:34:28.331Z [INFO]: Warning: Permanently added the RSA host key for IP address '52.78.231.108' to the list of known hosts.
2020-04-02T23:34:34.355Z [INFO]: # Switching to commit: 921b7ebf95e216089ef80ac49cda70cc4fcbb8ea
2020-04-02T23:34:34.684Z [INFO]: Note: checking out '921b7ebf95e216089ef80ac49cda70cc4fcbb8ea'.
                                 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 921b7eb fix: disable the ok button when lesion has not choose
2020-04-02T23:34:34.685Z [INFO]: # Checking for Git submodules at: /codebuild/output/src568054135/src/cxr-opt-frontend-2002-mgh/.gitmodules
2020-04-02T23:34:34.718Z [INFO]: # Retrieving cache...
2020-04-02T23:34:34.774Z [INFO]: # Extracting cache...
2020-04-02T23:34:34.783Z [INFO]: # Extraction completed
2020-04-02T23:34:34.783Z [INFO]: # Retrieving environment cache...
2020-04-02T23:34:34.838Z [INFO]: # Retrieved environment cache

Frontend

                                 # Starting phase: preBuild
                                 # Executing command: echo /usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2020-04-02T23:35:14.887Z [INFO]: /usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
                                 # Completed phase: preBuild
                                 # Starting phase: build
                                 # Executing command: echo /usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
                                 /usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
                                 # Executing command: npm install
2020-04-02T23:35:14.888Z [WARNING]: /codebuild/output/src568054135/src/cxr-opt-frontend-2002-mgh/amplify.sh: line 13: npm: command not found
2020-04-02T23:35:14.888Z [ERROR]: !!! Build failed
2020-04-02T23:35:14.979Z [ERROR]: !!! Non-Zero Exit Code detected
2020-04-02T23:35:14.979Z [INFO]: # Starting environment caching...
2020-04-02T23:35:14.980Z [INFO]: # Environment caching completed
Terminating logging...

image

ganipcanot commented 4 years ago

@iamssen Very strange... would you mind sharing your appId/region so I can look further:

You can find it here:

Under appSettings --> General --> AppArn it will look something like this:

arn:aws:amplify:region:accountId:apps/appId

Also if possible could you share the git repository you are trying to deploy?

iamssen commented 4 years ago

@ganipcanot and there is no npm at backend phase too.

                                 # Starting phase: preBuild
                                 # Executing command: echo /usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2020-04-02T23:50:27.482Z [INFO]: /usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
                                 # Completed phase: preBuild
                                 # Starting phase: build
                                 # Executing command: echo /usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
                                 /usr/local/rvm/gems/ruby-2.4.6/bin:/usr/local/rvm/gems/ruby-2.4.6@global/bin:/usr/local/rvm/rubies/ruby-2.4.6/bin:/usr/local/rvm/bin:/root/.yarn/bin:/root/.config/yarn/global/node_modules/.bin:/root/.local/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
                                 # Executing command: npm install
2020-04-02T23:50:27.483Z [WARNING]: /codebuild/output/src702284066/src/cxr-opt-frontend-2002-mgh/amplify.sh: line 13: npm: command not found
2020-04-02T23:50:27.484Z [ERROR]: !!! Build failed
2020-04-02T23:50:27.553Z [ERROR]: !!! Non-Zero Exit Code detected
2020-04-02T23:50:27.553Z [INFO]: # Starting environment caching...
2020-04-02T23:50:27.554Z [INFO]: # Environment caching completed
Terminating logging...
version: 1.0
backend:
  phases:
    preBuild:
      commands:
        - echo $PATH
    build:
      commands:
        - echo $PATH
        - npm install
        - npm run build
frontend:
  phases:
    preBuild:
      commands:
        - echo $PATH
    build:
      commands:
        - echo $PATH
        - npm install
        - npm run build
  artifacts:
    baseDirectory: dist/app/browser
    files:
      - '**/*'
iamssen commented 4 years ago

@ganipcanot arn:aws:amplify:ap-northeast-2:198213787435:apps/d370uahq7kadae

I'll talk to the company about sharing the git repository.

However, this problem also occurred when setting up other repositories. At the time, it was solved by deleting the app and creating a new one, but this time the method did not work.

ganipcanot commented 4 years ago

Thanks for the appId/region I'll take a look.

jorgekleeen commented 4 years ago

@iamssen Can you try moving the preBuild commands down to build and see if it works?

Does not make sense to have a preBuild phase where to install dependencies, if you are not able to use it on later phases...

Any updates on this?

ihao8 commented 4 years ago

It seems like some files in your package caused the command not found. Would you mind share your repo with us? or could you please check your package.json or .npmrc file, those files might caused the issue.

AlexBonilloWefox commented 4 years ago

Hi all!

I'm having the exact same issue. It seems that npm command is not found during build process.

Error

Starting phase: preBuild \n
Executing command: npm ci
2020-07-09T10:47:15.666Z [WARNING]: /codebuild/output/src892512454/src/<repo>/amplify.sh: line 5: npm: command not found
2020-07-09T10:47:15.667Z [ERROR]: !!! Build failed
2020-07-09T10:47:15.812Z [ERROR]: !!! Non-Zero Exit Code detected
2020-07-09T10:47:15.812Z [INFO]: # Starting environment caching...
2020-07-09T10:47:15.813Z [INFO]: # Environment caching completed
Terminating logging...

Provision

# 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
RUN yum -y update && \
    yum -y install \
        alsa-lib-devel \
        autoconf \
        automake \
        bzip2 \
        bison \
        bzr \
        cmake \
        expect \
        fontconfig \
        git \
        gcc-c++ \
        GConf2-devel \
        gtk2-devel \
        gtk3-devel \
        libnotify-devel \
        libpng \
        libpng-devel \
        libffi-devel \
        libtool \
        libX11 \
        libXext \
        libxml2 \
        libxml2-devel \
        libXScrnSaver \
        libxslt \
        libxslt-devel \
        libyaml \
        libyaml-devel \
        nss-devel \
        openssl-devel \
        openssh-clients \
        patch \
        procps \
        python3 \
        python3-devel \
        readline-devel \
        sqlite-devel \
        tar \
        tree \
        unzip \
        wget \
        which \
        xorg-x11-server-Xvfb \
        zip \
        zlib \
        zlib-devel \
    yum clean all && \
    rm -rf /var/cache/yum

## Install Node 8 & 10 & 12
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
RUN curl -o- -L https://yarnpkg.com/install.sh > /usr/local/bin/yarn-install.sh
RUN /bin/bash -c ". ~/.nvm/nvm.sh && \
    nvm install $VERSION_NODE_8 && nvm use $VERSION_NODE_8 && \
    nvm install $VERSION_NODE_10 && nvm use $VERSION_NODE_10 && \
    npm install -g sm grunt-cli bower vuepress gatsby-cli && \
    bash /usr/local/bin/yarn-install.sh --version $VERSION_YARN && \
    nvm install $VERSION_NODE_12 && nvm use $VERSION_NODE_12 && \
    npm install -g sm grunt-cli bower vuepress gatsby-cli && \
    bash /usr/local/bin/yarn-install.sh --version $VERSION_YARN && \
    nvm alias default node && nvm cache clear"

## Install Ruby 2.4.x and 2.6.x
RUN gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
    curl -sL https://get.rvm.io | bash -s -- --with-gems="bundler"

ENV PATH /usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN /bin/bash --login -c "\
    rvm install $VERSION_RUBY_2_4 && rvm use $VERSION_RUBY_2_4 && gem install bundler -v $VERSION_BUNDLER && gem install jekyll && \
    rvm install $VERSION_RUBY_2_6 && rvm use $VERSION_RUBY_2_6 && gem install bundler -v $VERSION_BUNDLER && gem install jekyll && \
    rvm cleanup all"

## Install awscli
RUN /bin/bash -c "pip3 install awscli && rm -rf /var/cache/apk/*"

## Install SAM CLI
RUN /bin/bash -c "pip3 install aws-sam-cli"

## Install Hugo
RUN wget https://github.com/gohugoio/hugo/releases/download/v${VERSION_HUGO}/hugo_${VERSION_HUGO}_Linux-64bit.tar.gz && \
    tar -xf hugo_${VERSION_HUGO}_Linux-64bit.tar.gz hugo -C / && \
    mv /hugo /usr/bin/hugo && \
    rm -rf hugo_${VERSION_HUGO}_Linux-64bit.tar.gz

## Installing Cypress
RUN /bin/bash -c ". ~/.nvm/nvm.sh && \
    nvm use ${VERSION_NODE_DEFAULT} && \
    npm install -g --unsafe-perm=true --allow-root cypress"

## Install AWS Amplify CLI for VERSION_NODE_DEFAULT and VERSION_NODE_10
RUN /bin/bash -c ". ~/.nvm/nvm.sh && nvm use ${VERSION_NODE_DEFAULT} && \
    npm install -g @aws-amplify/cli@${VERSION_AMPLIFY}"
RUN /bin/bash -c ". ~/.nvm/nvm.sh && nvm use ${VERSION_NODE_10} && \
    npm install -g @aws-amplify/cli@${VERSION_AMPLIFY}"

## Environment Setup
RUN echo export PATH="\
/usr/local/rvm/gems/ruby-${VERSION_RUBY_DEFAULT}/bin:\
/usr/local/rvm/gems/ruby-${VERSION_RUBY_DEFAULT}@global/bin:\
/usr/local/rvm/rubies/ruby-${VERSION_RUBY_DEFAULT}/bin:\
/usr/local/rvm/bin:\
/root/.yarn/bin:\
/root/.config/yarn/global/node_modules/.bin:\
/root/.nvm/versions/node/${VERSION_NODE_DEFAULT}/bin:\
$(python3 -m site --user-base)/bin:\
$PATH" >> ~/.bashrc && \
    echo export GEM_PATH="/usr/local/rvm/gems/ruby-${VERSION_RUBY_DEFAULT}" >> ~/.bashrc && \
    echo "nvm use ${VERSION_NODE_DEFAULT} 1> /dev/null" >> ~/.bashrc

ENTRYPOINT [ "bash", "-c" ]

Cloning Repository

2020-07-09T10:46:29.000Z [INFO]: Git SSH Key acquired
2020-07-09T10:46:29.070Z [INFO]: # Cloning repository: git@github.com:repo-folder/repo.git
2020-07-09T10:46:29.171Z [INFO]: Agent pid 131
2020-07-09T10:46:29.196Z [INFO]: Identity added: /root/.ssh/git_rsa (/root/.ssh/git_rsa)
2020-07-09T10:46:29.360Z [INFO]: Cloning into 'repo'...
2020-07-09T10:46:29.880Z [INFO]: Warning: Permanently added the RSA host key for IP address '140.82.118.3' to the list of known hosts.
2020-07-09T10:46:33.392Z [INFO]: # Switching to commit: e876ba100055bb86f6c57b80a70f7a7004860d08
2020-07-09T10:46:33.517Z [INFO]: Note: checking out 'e876ba100055bb86f6c57b80a70f7a7004860d08'.
                                 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 e876ba1 Merge pull request #15 from repo-folder/feature/DFM-136
2020-07-09T10:46:33.518Z [INFO]: # Checking for Git submodules at: /codebuild/output/src892512454/src/repo/.gitmodules
2020-07-09T10:46:33.548Z [INFO]: # Retrieving cache...
2020-07-09T10:46:39.832Z [INFO]: # Extracting cache...
2020-07-09T10:46:49.968Z [INFO]: # Extraction completed
2020-07-09T10:46:50.113Z [INFO]: # Retrieving environment cache...
2020-07-09T10:46:50.139Z [INFO]: # Retrieved environment cache

Cannot provide access to the repo, but what I can tell you is that previous build was working then following changes were applied:

what do you think?

AlexBonilloWefox commented 4 years ago

Amplify.yml:

version: 0.1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - REACT_APP_API_URL=$REACT_APP_API_URL npm run build
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
OrderAndCh4oS commented 3 years ago

I have the same issue, I also have a .npmrc in the root of the React project with config for a private CodeArtifact repo.

@name:registry=https://name-1234567890.d.codeartifact.eu-west-1.amazonaws.com/npm/si-dev/
//name-1234567890.d.codeartifact.eu-west-1.amazonaws.com/npm/si-dev/:always-auth=true
//name-1234567890.d.codeartifact.eu-west-1.amazonaws.com/npm/si-dev/:_authToken=${CODEARTIFACT_AUTH_TOKEN}
Athena96 commented 3 years ago

closing, feel free to re-open if you are still facing this issue, thank you!

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.