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"
}
]
}
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.
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
Yea, shouldn鈥檛 be needed in the next release. Thanks for raising this!
Fixed in 73c940a73205d761230f8d6bf81ecfd460ba28a9.
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.
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
@skeletorkun ...not an issue with create-react-app, chromeos sets noexec flag on sdcards: https://github.com/dnschneid/crouton/issues/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").
Most helpful comment
Maybe 73c940a will fix this.
Can you try running
?
I assumed Node does this automatically but maybe not.