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

Error when ~/.cache/node/corepack is on read-only file system #420

Closed
marvinruder opened this issue Mar 7, 2024 · 0 comments · Fixed by #421
Closed

Error when ~/.cache/node/corepack is on read-only file system #420

marvinruder opened this issue Mar 7, 2024 · 0 comments · Fixed by #421

Comments

@marvinruder
Copy link

When running corepack enable in a Docker build stage, the directory ~/.cache/node/corepack is filled with my package manager. I would like to mount this directory and other immutable caches into a later build stage using an expression like:

FROM node:21.7.0-alpine AS build
RUN --mount=type=bind,from=yarn,source=/root/.cache,target=/root/.cache \
  yarn …
  # here I do not have to run `corepack enable` again

With Corepack 0.25.2 in node:21.7.0-alpine, this no longer works:

Internal Error: EROFS: read-only file system, open '/root/.cache/node/corepack/lastKnownGood.json'
    at async Object.open (node:internal/fs/promises:637:25)
    at async Engine.getDefaultVersion (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:23337:29)
    at async executePackageManagerRequest (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:24207:28)
    at async BinaryCommand.validateAndExecute (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:21173:22)
    at async _Cli.run (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:22148:18)
    at async Object.runMain (/usr/local/lib/node_modules/corepack/dist/lib/corepack.cjs:24279:12)

This looks like a regression of #382 where the case of ENOENT was considered, but EROFS was not.

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

Successfully merging a pull request may close this issue.

1 participant