Skip to content

permission denied react-scripts when running in docker #508

Closed
@SepiaGroup

Description

@SepiaGroup

I am trying to run my app in a docker container and deploy it to elastic beanstalk. i received the following error:

Step 7 : RUN npm run build
  Running in 07e37004f950
  npm info it worked if it ends with ok
  npm info using [email protected]
  npm info using [email protected]
  npm info lifecycle [email protected]~prebuild: [email protected]
  npm info lifecycle [email protected]~build: [email protected]

  > [email protected] build /usr/src/app
  > react-scripts build

  sh: 1: react-scripts: Permission denied

  npm info lifecycle [email protected]~build: Failed to exec build script
  npm ERR! Linux 4.4.16-27.56.amzn1.x86_64
  npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
  npm ERR! node v6.4.0
  npm ERR! npm  v3.10.3
  npm ERR! code ELIFECYCLE
  npm ERR! [email protected] build: `react-scripts build`
  npm ERR! Exit status 126

my docker file is:

# Dockerfile
FROM node:6

# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

# Install app dependencies
COPY package.json /usr/src/app/
RUN npm install

# Bundle app source
COPY . /usr/src/app

# Build and optimize react app
RUN npm run build

EXPOSE 9000

# defined in package.json
CMD [ "npm", "run", "start:server" ]

And my Dockerrun.aws.json is:

{
 "AWSEBDockerrunVersion": "1",

  "Ports": [
    {
      "ContainerPort": "9000"
    }
  ],

  "Volumes": [
    {
      "HostDirectory": "/var/app/current",
      "ContainerDirectory": "/usr/src/app"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions