devbox
devbox copied to clipboard
Corepack symlinks are relative and not absolute (they break if you move the devbox to a different directory depth)
What happened?
after moving devbox with corepack enabled to a different directory the following error appears after running devbox shell:
Internal Error: EEXIST: file already exists, symlink '../../../../../../../../nix/store/6njmhaghg7x19cra79g8ljvxcxr77sfq-nodejs-14.21.3/lib/node_modules/corepack/dist/pnpm.js' -> '/Users/foucist/nested/test-devbox/.devbox/virtenv/nodejs/corepack-bin/pnpm'
Error: EEXIST: file already exists, symlink '../../../../../../../../nix/store/6njmhaghg7x19cra79g8ljvxcxr77sfq-nodejs-14.21.3/lib/node_modules/corepack/dist/pnpm.js' -> '/Users/foucist/nested/test-devbox/.devbox/virtenv/nodejs/corepack-bin/pnpm'
It should affect any corepack-bin pnpm / pnpx / yarn / yarnpkg regardless of the version of nodejs/etc due to the relative linking to reach /nix folder.
Steps to reproduce
- mkdir test-devbox
- cat > devbox.json
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.0/.schema/devbox.schema.json",
"packages": ["nodejs@14"],
"env": {
"DEVBOX_COREPACK_ENABLED": "true"
},
"shell": {
"init_hook": [
"echo 'Welcome to devbox!' > /dev/null"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
- devbox shell
- exit
- cd ..
- mkdir nested
- mv test-devbox nested
- cd nested/test-devbox
- devbox shell
Command
shell
devbox.json
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.0/.schema/devbox.schema.json",
"packages": ["nodejs@14"],
"env": {
"DEVBOX_COREPACK_ENABLED": "true"
},
"shell": {
"init_hook": [
"echo 'Welcome to devbox!' > /dev/null"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
Devbox version
0.13.0
Nix version
2.24.7
What system does this bug occur on?
macOS (Intel)
Debug logs
No response
Fixing this bug might fix #1984
Looks like it's a corepack issue. The command corepack enable --install-directory .devbox/virtenv/nodejs/corepack-bin installs relative symlinks.