Skip to content

[Bug?]: Yarn 3.2 breaks node_modules with docker volumes #4373

Closed
@basicdays

Description

@basicdays

Self-service

  • I'd be willing to implement a fix

Describe the bug

Yarn 3.1 works as expected. Yarn 3.2 will fail on yarn install with the following error:

➤ YN0000: ┌ Link step
➤ YN0001: │ Error: EBUSY: resource busy or locked, rmdir '/workspace/node_modules'
➤ YN0000: └ Completed in 4s 519ms

This occurs in the following environment:

  • Yarn 3.2
  • Using yarn with nodeLinker: node-modules
  • Running within a Docker container
  • Using a Docker volume for the node_modules folder. This is used in my case with VSCode's devcontainer feature, but it can happen with just using Docker directly.

To reproduce

If necessary, I can create a tiny git repo that has Docker and yarn setup to reproduce this. Otherwise just creating a Docker container with a volume at node_modules and running any kind of yarn install. The host machine will require Docker and Docker Compose for it to run.

Environment

System:
  OS: Linux 5.10 Debian GNU/Linux 10 (buster) 10 (buster)
  CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
  Node: 12.22.7 - /tmp/xfs-560392c2/node
  Yarn: 3.2.0 - /tmp/xfs-560392c2/yarn
  npm: 6.14.15 - /usr/local/bin/npm

Additional context

Attempting to delete a folder within a Docker container that is managed by a Docker volume will never work. Something within yarn 3.2 switched to attempting to delete the folder completely. I've just used a simple bash script if I ever need to clear out the node_modules directory for whatever reason:

#!/usr/bin/env bash
shopt -s dotglob nullglob
rm -rf "node_modules/*"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwaiting for feedbackWill autoclose in a while unless more data are provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions