Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

permission denied react-scripts when running in docker #508

Closed
SepiaGroup opened this issue Aug 28, 2016 · 7 comments
Closed

permission denied react-scripts when running in docker #508

SepiaGroup opened this issue Aug 28, 2016 · 7 comments
Milestone

Comments

@SepiaGroup
Copy link

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"
    }
  ]
}
@gaearon
Copy link
Contributor

gaearon commented Aug 28, 2016

Maybe 73c940a will fix this.

Can you try running

chmod a+x app/node_modules/.bin/react-scripts

?

I assumed Node does this automatically but maybe not.

@SepiaGroup
Copy link
Author

WOOHOO!!!

i added the below and it worked! thanks! so this will not be need in the next release?

RUN chmod a+x /usr/src/app/node_modules/.bin/react-scripts

@gaearon
Copy link
Contributor

gaearon commented Aug 28, 2016

Yea, shouldn’t be needed in the next release. Thanks for raising this!

@gaearon gaearon added this to the 0.3.0 milestone Aug 28, 2016
@gaearon
Copy link
Contributor

gaearon commented Sep 1, 2016

Fixed in 73c940a.

@gaearon gaearon closed this as completed Sep 1, 2016
@furkle
Copy link

furkle commented Apr 16, 2017

Just for the record, this fix is still needed when downloading git repos made on Windows 10 onto an OSX environment. Not sure if there's anything at all that can be done to fix that.

@skeletorkun
Copy link

skeletorkun commented Dec 17, 2017

Hi Dan,
I have the same/similar issue that i have described here. I thought I d comment here, instead of creating a new issue. Though, it s not in a docker but in my crosh shell of a chromebook on dev mode.
https://stackoverflow.com/questions/47853738/sh-react-scripts-permission-denied-with-create-react-app
@gaearon

@jversoza
Copy link

jversoza commented May 4, 2018

@skeletorkun ...not an issue with create-react-app, chromeos sets noexec flag on sdcards: dnschneid/crouton#3423

One workaround is running react-scripts.js using node react-scripts.js instead of ./react-scripts (so, for example, in package.json..."start": "node ./node_modules/react-scripts/bin/react-scripts.js start").

@lock lock bot locked and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants