I am using elastic beanstalk from AWS to deploy and host a react application using Docker.

The deployment fails mysteriously, even though I succeed building the Docker image on my local machine. An inspection to the logs on the EC2 instance (using eb ssh) does not provide more explanation that this:

Step 5/14 : COPY package.json /usr/src/app/package.json
---> Using cache
---> f06f2c9d6519
Step 6/14 : RUN npm install
---> Running in 9926fc11431f
The command '/bin/sh -c npm install' returned a non-zero code: 1
Failed to build Docker image aws_beanstalk/staging-app: 2c9d6519

I even tried to run the npm install command inside the last layer of the built container using

sudo docker commit 9926fc11431f test && docker run -it test bash
cd /path/to/wordir
npm install 

But the return code is actually 0

Is there any other way this could fail and logs return me wrong errors ?

0 Answers