Docker - "Error: EACCES: permission denied, mkdir '/project/node_modules/.cache/@babel'" Docker - "Error: EACCES: permission denied, mkdir '/project/node_modules/.cache/@babel'" docker docker

Docker - "Error: EACCES: permission denied, mkdir '/project/node_modules/.cache/@babel'"


I had the same problem with npm. I fixed it using:

RUN npm config set unsafe-perm true

The other way is to specify it in your install command:

npm install -g --unsafe-perm thePackage

You can find the documentation for it here: https://docs.npmjs.com/misc/config#unsafe-perm


You probably have a volume specified in your docker-compose file and mounted as /project/node_modules, your user does not have permission to access that directory on your local disk.

Find out which local directory the volume is mapped to using this SO answer and change the owner with:

sudo chown -R yourusername:yourusername /path/to/node_modules


Try setting the user before running yarn in your Dockerfile.

# Give owner rights to the current userRUN chown -Rh $user:$user /projectUSER $user# Install (local) Yarn packages and buildRUN yarn