permission denied react-scripts when running in docker
See original GitHub issueI 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 npm@3.10.3
npm info using node@v6.4.0
npm info lifecycle LiveOn@0.0.1~prebuild: LiveOn@0.0.1
npm info lifecycle LiveOn@0.0.1~build: LiveOn@0.0.1
> LiveOn@0.0.1 build /usr/src/app
> react-scripts build
sh: 1: react-scripts: Permission denied
npm info lifecycle LiveOn@0.0.1~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! LiveOn@0.0.1 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"
}
]
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
node.js - "npm run build" = "react-scripts: Permission denied"
Solution 1: I think you have react-script globally installed. so try this command npm install react-scripts --save.
Read more >Docker: npm permission denied - Code with Mosh Forum
My local machine is running Ubuntu and when I run this command: sudo docker build -t react-app . I get this error from...
Read more >[Solved]-"npm run build" = "react-scripts: Permission denied"
Solution 1: I think you have react-script globally installed. so try this command npm install react-scripts --save. and then run the application again....
Read more >Permission Denied When Installing NPM Packages With Docker
I have the following Dockerfile for a React app: ## base image FROM node:11.12.0-alpine ## set working directory WORKDIR /usr/src/app ## add ...
Read more >react-scripts not found docker - You.com | The AI Search ...
With a normal installation, docker should have access to your resource. But I have seen on my coworker's machine there were some weird...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Maybe 73c940a will fix this.
Can you try running
?
I assumed Node does this automatically but maybe not.
@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”).