-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Bug?]: "ENOENT: no such file or directory, link ..." when configured for nodeLinker: pnpm
and running in Docker with mounted filesystem
#6453
Comments
moduleLinker: pnpm
and running in Docker with mounted filesystemnodeLinker: pnpm
and running in Docker with mounted filesystem
@camrionnvmff Thanks for the input, but I don't see how any of what you're suggesting would seem to apply here. Specifically:
The problem is that $ #### In host, return file system back to initial example state (just in case)
$ rm -fr .yarn node_modules/ yarn-cache yarn.lock
$ ls -Fa
./ ../ .yarnrc.yml Dockerfile package.json
$ #### Start interactive Docker session (assumes "yarntest" image is already built per instructions in issue description)
$ docker run -it -v .:/app --entrypoint bash yarntest
root@394ea5ab1794:/app# #### (Now inside of Docker ...)
root@394ea5ab1794:/app# #### Run yarn (generates error below)
root@394ea5ab1794:/app# yarn
( snip )
[Error: ENOENT: no such file or directory, link '/app/yarn-cache/index/5a/5aaf48196ddd4d007a3067aa7f30303ca8e4b29c.dat' -> '/app/node_modules/.store/resolve-from-npm-4.0.0-f758ec21bf/package/license'] {
errno: -2,
code: 'ENOENT',
syscall: 'link',
path: '/app/yarn-cache/index/5a/5aaf48196ddd4d007a3067aa7f30303ca8e4b29c.dat',
dest: '/app/node_modules/.store/resolve-from-npm-4.0.0-f758ec21bf/package/license'
}
( snip )
root@394ea5ab1794:/app# #### Verify "path" file named in error actually exists
root@394ea5ab1794:/app# ls /app/yarn-cache/index/5a/5aaf48196ddd4d007a3067aa7f30303ca8e4b29c.dat
/app/yarn-cache/index/5a/5aaf48196ddd4d007a3067aa7f30303ca8e4b29c.dat
root@394ea5ab1794:/app# #### Verify "dest" file named in error does not exist (expected)
root@394ea5ab1794:/app# ls /app/node_modules/.store/resolve-from-npm-4.0.0-f758ec21bf/package/license
ls: cannot access '/app/node_modules/.store/resolve-from-npm-4.0.0-f758ec21bf/package/license': No such file or directory
root@394ea5ab1794:/app# #### Create hard link from "source" to "path" (what yarn is trying to do)
root@394ea5ab1794:/app# ln /app/yarn-cache/index/5a/5aaf48196ddd4d007a3067aa7f30303ca8e4b29c.dat /app/node_modules/.store/resolve-from-npm-4.0.0-f758ec21bf/package/license
root@394ea5ab1794:/app# #### Verify hard link succeeded
root@394ea5ab1794:/app# ls /app/node_modules/.store/resolve-from-npm-4.0.0-f758ec21bf/package/license
/app/node_modules/.store/resolve-from-npm-4.0.0-f758ec21bf/package/license |
FWIW, my suspicion is this is caused by a race condition of some sort, where |
Quick breadcrumb comment ... I reached out to Yarn support on discord, and @arcanis responded with the following:
I looked at the @quezo and I have been digging into this a bit further on the Docker side and suspect this may be something to do with Docker Desktop's handling of the file system on Mac. We tested the above example on an EC2 Linux instance and it worked without error, fwiw. |
Self-service
Describe the bug
As the title says, yarn throws a "no such file or directory" error while trying to hard-link a file from the
globalStore
into a project'snode_modules/.store
when configured forpnpm
mode, and when running in Docker and mounting a host volumeSee the attached MRE for reproduction recipe. In addition to the reproduction below, it's worth noting...
cd
into the example directory and runyarn
on your host (i.e. not in Docker), it runs with no issue. (Or at least for me it did, on my Mac system.)yarn
on the host (successfully) causes the problem to go away when running in Docker... presumably because theglobalStore
and.store
have been properly linked up../node_modules
and./yarn-cache
should return the example back to a state that produces the error when installing in DockerTo reproduce
With Docker Desktop installed...
(contains 3 files:
Dockerfile
,package.json
, andyarnrc.yml
)cd
into the unpacked directory, then ...docker build -t yarntest .
docker run -v .:/app yarntest
On my system, the above results in the following:
Environment
System: OS: macOS 14.5 CPU: (10) arm64 Apple M1 Max Binaries: Node: 20.16.0 - /private/var/folders/h3/trw0qb4n5t39jdpfqnt20qy80000gn/T/xfs-c29d33b7/node Yarn: 4.4.0 - /private/var/folders/h3/trw0qb4n5t39jdpfqnt20qy80000gn/T/xfs-c29d33b7/yarn npm: 10.8.1 - ~/.nvm/versions/node/v20.16.0/bin/npm
Additional context
No response
The text was updated successfully, but these errors were encountered: