Skip to content

[Bug] During link step, attempting to rm nested node_modules causes errors if node_modules is a docker volume or similar #1184

Closed
@milesrichardson

Description

@milesrichardson
  • I'd be willing to implement a fix

Describe the bug

In some cases, when using nodeLinker: node-modules, during the link step, yarn will attempt to delete the entire node_modules directory, instead of only its contents. This causes problems with the common docker pattern of mounting node_modules as a volume, resulting in an error like the following:

➤ YN0000: ┌ Link step
➤ YN0001: │ Error: While removing /src/js/cloud/catalog/node_modules EBUSY: resource busy or locked, rmdir '/src/js/cloud/catalog/node_modules'
➤ YN0000: └ Completed in 13.99s

Note in this case, node_modules is in a subdirectory of a monorepo.

To Reproduce

Sorry, I am unable to provide a minimal reproduction.

Environment if relevant (please complete the following information):

  • OS: [e.g. OSX, Linux, Windows, ...] Linux + docker
  • Node version [e.g. 8.15.0, 10.15.1, ...] v13.11.0
  • Yarn version [e.g. 2.0.0-rc1, ...] 2.0.0-rc.30

Additional context

I found this issue -- #1108 -- which may have fixed it. So I tried upgrading yarn using the following command:

root@a9290f036923:/src/js/cloud# yarn set version latest
➤ YN0000: Selecting the highest release amongst 1.22.4 and 18 others
➤ YN0000: Downloading https://github.com/yarnpkg/yarn/releases/download/v1.22.4/yarn-1.22.4.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-1.22.4.js
➤ YN0000: Done in 1.86s
root@a9290f036923:/src/js/cloud# yarn --version
2.0.0-rc.30

But it still seems to be on 2.0.0-rc.30 after running it. As far as I can tell from the releases page, this version does not include the fix linked above, so I am unable to confirm the fix works as I am unable to upgrade to a version including it.

Maybe this is as simple as upgrading yarn. I've searched the docs and am unclear on the best way to do this, could you please advise if so?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions