heroku / heroku/buildpacks-nodejs

Problem if node_modules is mounted as a volume

Open
#112 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
28
Forks
17
Avg merge
1d 16h
Merged PRs (30d)
14

Description

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:

https://github.com/heroku/buildpacks-nodejs/blob/46dec4f3d9be21d320b6bb912061f1b7a0c63c05/buildpacks/yarn/bin/build#L15

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:

https://github.com/heroku/buildpacks-nodejs/blob/46dec4f3d9be21d320b6bb912061f1b7a0c63c05/buildpacks/npm/bin/build#L16

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.