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

Patch Package fails on Gitlab CI (Docker) #185

Closed
katoha opened this issue Oct 27, 2019 · 4 comments
Closed

Patch Package fails on Gitlab CI (Docker) #185

katoha opened this issue Oct 27, 2019 · 4 comments

Comments

@katoha
Copy link

katoha commented Oct 27, 2019

When trying to run a patch-package during a Docker build on CI (Gitlab) it fails with the following error.

npm WARN lifecycle <packagename>~postinstall: cannot run in wd <packagename> patch-package (wd=/app)

In order to fix this you need to add a .npmrc file with the following declaration making sure to copy the file to your Dockerfile.

unsafe-perm = true

The above information should be added to the README.md file for other users

@ds300 ds300 changed the title Patch Package fails on Docker Build for CI - update README with resolution Patch Package fails on Gitlab CI (Docker) Oct 30, 2019
@theY4Kman
Copy link

Thank you for mentioning this! Saved me a lot of headache in our build process :)

@ds300
Copy link
Owner

ds300 commented Dec 19, 2019

I added this to the README. Thanks so much for sharing 🙏 ❤️

@niccolofanton
Copy link

a bit off topic but if you are running on docker remember also to copy your .npmrc and patches folder inside the workdir!

@agwells
Copy link

agwells commented May 28, 2021

Another solution is to run npm in your container as a non-root user.

If you're using the official node Docker images, it ships with a non-root user called node: https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants