vite-plugin-rsw
vite-plugin-rsw copied to clipboard
Can't build with yarn3 berry (EROFS)
Describe the bug
When using yarn3 (berry), the @rsw/cli
dependency doesn't build with the following error:\
➤ YN0000: ┌ Link step
➤ YN0007: │ @rsw/cli@npm:0.7.3 must be built because it never has been before or the last one failed
➤ YN0009: │ @rsw/cli@npm:0.7.3 couldn't be built successfully (exit code 1)
➤ YN0000: └ Completed in 0s 225ms
➤ YN0000: Failed with errors in 0s 350ms
Logs:
# Script name: postinstall
/home/alaa/x/x/.pnp.cjs:1985
return Object.assign(new Error(`${code}: ${message}`), {code});
^
Error: EROFS: read-only filesystem, mkdir '/node_modules/binary-install/bin'
at makeError$1 (/home/alaa/hs/x/.pnp.cjs:1985:24)
at EROFS (/home/alaa/hs/x/.pnp.cjs:2012:10)
at ZipFS.mkdirSync (/home/alaa/hs/x/.pnp.cjs:3872:13)
at ZipFS.mkdirpSync (/home/alaa/hs/x/.pnp.cjs:2202:16)
at ZipFS.mkdirSync (/home/alaa/hs/x/.pnp.cjs:3868:12)
at /home/alaa/hs/x/.pnp.cjs:4870:20
at /home/alaa/hs/x/.pnp.cjs:5026:60
at ZipOpenFS.getZipSync (/home/alaa/hs/x/.pnp.cjs:5155:14)
at ZipOpenFS.makeCallSync (/home/alaa/hs/x/.pnp.cjs:5026:17)
at ZipOpenFS.mkdirSync (/home/alaa/hs/x/.pnp.cjs:4867:17) {
code: 'EROFS'
}
To Reproduce Steps to reproduce the behavior:
- Start a new project with yarn3 (berry) via
yarn init
- yarn add vite-plugin-rsw
- See error
Expected behavior Not to error.
Desktop (please complete the following information):
- OS: Windows 11 - WSL2 (Ubuntu 21.04)
- Version: Latest
- Node: 17.7.1
- Yarn: 3.2.0
It seems to be a permissions issue, you can try using nvm or fnm to manage node.
Or install to the global system via cargo and then execute the rsw
command.
# step 1
cargo install rsw
# step 2
rsw -h
Hey @lencx, thanks for the quick response!
I am already using fnm
, and rsw
is already installed globally.
[hs] rsw --version
rsw 0.7.3
[hs] fnm current
v17.7.1
[hs] yarn
➤ YN0000: ┌ Link step
➤ YN0007: │ @rsw/cli@npm:0.7.3 must be built because it never has been before or the last one failed
➤ YN0009: │ @rsw/cli@npm:0.7.3 couldn't be built successfully (exit code 1)
➤ YN0000: └ Completed in 0s 242ms
➤ YN0000: Failed with errors in 0s 381ms
As for permissions, it seems to me that it tries to mkdir
in /node_modules/binary-install/bin
? That part I still don't fully understand.
rsw
is an executable binary implemented by rust, and binary-install/bin
is responsible for pulling the binary. I guess it may be caused by this reason. How to fix npm throwing error without sudo
It seems it's a problem with yarn's pnp with rsw
. After switching the nodeLinker
it worked fine but I had to opt out from pnp :/
Workaround
1 - Create a .yarnrc.yml
file
2 - Add this line: nodeLinker: pnpm
Overall you can change the nodeLinker
to be anything other than the default pnp
.