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

Can't build with yarn3 berry (EROFS) #31

Open
AlaaZorkane opened this issue Mar 16, 2022 · 4 comments
Open

Can't build with yarn3 berry (EROFS) #31

AlaaZorkane opened this issue Mar 16, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@AlaaZorkane
Copy link

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:

  1. Start a new project with yarn3 (berry) via yarn init
  2. yarn add vite-plugin-rsw
  3. 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
@AlaaZorkane AlaaZorkane added the bug Something isn't working label Mar 16, 2022
@lencx
Copy link
Member

lencx commented Mar 16, 2022

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

@AlaaZorkane
Copy link
Author

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.

@lencx
Copy link
Member

lencx commented Mar 16, 2022

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

@AlaaZorkane
Copy link
Author

AlaaZorkane commented Mar 16, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants