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

Problem if node_modules is mounted as a volume #112

Open
sawmurai opened this issue Aug 5, 2021 · 2 comments
Open

Problem if node_modules is mounted as a volume #112

sawmurai opened this issue Aug 5, 2021 · 2 comments

Comments

@sawmurai
Copy link

sawmurai commented Aug 5, 2021

If node_modules is mounted as a volume during the build process, the build process breaks because the build script is trying to remove the node_modules folder.

Skipping 'restore' due to clearing cache
===> BUILDING
[builder] [INFO] Node.js Buildpack
[builder] rm: cannot remove 'node_modules': Device or resource busy
[builder] ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle. This may be the result of using an untrusted builder: failed with status code: 145
💥 Build failed

The responsible line is this one:

rm -rf "$build_dir/node_modules"

Would it be possible to change that line to rm -rf "$build_dir/node_modules/*" or would the presence of an empty folder break succeeding code? Happy to provide a PR if that would be a feasible solution.

Edit:
I guess the same goes for this line:

rm -rf "$build_dir/node_modules"

@joshwlewis
Copy link
Member

When node_modules gets fairly large, it's possible that rm -rf "$build_dir/node_modules/*" gets expanded to a massive command and hits Argument list too long errors. So, I'm not a fan of this exact solution. I think an empty node_modules would serve the same purpose as it not existing, though.

What is driving you to mount node_modules? Is this so you don't have to reinstall modules you've already installed locally?

@sawmurai
Copy link
Author

sawmurai commented Aug 5, 2021

Oh, I wasn't aware of the expansion problem, thanks for pointing that out. The reason we want to keep the node_modules folder is indeed that we do not want to reinstall everything. But maybe that is necessary.

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

2 participants