-
Notifications
You must be signed in to change notification settings - Fork 173
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
Can't use pnpm
via corepack when COREPACK_HOME
is read-only.
#459
Comments
I've built and used the newest master revision from the corepack repo and replaced the one in the image with that and then it works so I assume the issue has been addressed by "c449adc feat: separate read and write operations on lastKnownGood.json (#446)" |
Closed it as it's effectively a duplicate of #183 |
Will this be in node 20? It was merged only 3 days after v20.12.2 was released. |
it was released with Node 22.1.0 if I recollect right. |
(originally posted as a discussion post here: https://github.com/orgs/nodejs/discussions/52547)
We have a build infrastructure where we install Node.js and pnpm (via corepack) into a build folder which is then subsequently used to run install commands etc. COREPACK_HOME is also placed there (inside the Node.js installation folder) and It's never expected to be mutated after the initial installation thus the entire folder is marked read-only. This also makes it more likely to have reproducible builds. The issue we are facing now is that running
corepack pnpm
(orpnpm
directly) with COREPACK_HOME set to the previously mentioned read-only folder results in an error along the lines of:Internal Error: EACCES: permission denied, open '/corepack_cache/lastKnownGood.json' at async Object.open (node:internal/fs/promises:637:25) at async Engine.getDefaultVersion (/node/v21.7.3/lib/node_modules/corepack/dist/lib/corepack.cjs:23337:29) at async executePackageManagerRequest (/node/v21.7.3/lib/node_modules/corepack/dist/lib/corepack.cjs:24207:28) at async BinaryCommand.validateAndExecute (/node/v21.7.3/lib/node_modules/corepack/dist/lib/corepack.cjs:21173:22) at async _Cli.run (/node/v21.7.3/lib/node_modules/corepack/dist/lib/corepack.cjs:22148:18) at async Object.runMain (/node/v21.7.3/lib/node_modules/corepack/dist/lib/corepack.cjs:24279:12)
Any ideas why this is the case? Why should
corepack
need write-access tolastKnownGood.json
even though I have set COREPACK_DEFAULT_TO_LATEST to 0 and don't even allow network access? Is there a way to prevent that from happening without bypassing corepack entirely?How to reproduce it
We can easily reproduce the issue by creating a docker environment (I've used the latest ubuntu image here):
then installing Node.js and pnpm in the docker environment, creating a guest user and switching to the guest user account
Now we can try to run pnpm after setting
COREPACK_HOME
etc. againwhich will spit out one of the above error.
The text was updated successfully, but these errors were encountered: