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

Rust panicked / native SWC-based parser #2010

Closed
fabianwohlfart opened this issue Dec 17, 2023 · 4 comments
Closed

Rust panicked / native SWC-based parser #2010

fabianwohlfart opened this issue Dec 17, 2023 · 4 comments

Comments

@fabianwohlfart
Copy link

Environment

Nitro > 2.7.2 (2.8.0, 2.8.1)
Node >= 18
Linux on a Mittwald Server L – They are super restrictive in the information they provide. Through ssh it's not possible for me to determine which Ubuntu version is used.

Reproduction

Building a server with Nuxt nuxt build

Describe the bug

At the point where nuxt build will Building Nitro Server (preset: node-server) it suddenly errors out with a rust panic:

thread '<unnamed>' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/stacker-0.1.15/src/lib.rs:416:13:
assertion `left == right` failed
  left: 2
 right: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
error Command failed with signal "SIGABRT".

I am certainly sure, that it has to do with the native SWC-based parser, which was introduced in 2.8.0.
/usr/local/ is not writeable for my user.

Additional context

I would appreciate any help and advice in how to approach this error. I am a bit lost indeed… Should I also head over to @swc/cli to report this behavior?

Logs

No response

@pi0
Copy link
Member

pi0 commented Dec 21, 2023

Hi dear @fabianwohlfart i would be happy to help tracing back to upstream but need a runnable reproduction are you able to somehow share me one? 🙏🏼

@fabianwohlfart
Copy link
Author

fabianwohlfart commented Dec 21, 2023

Hi @pi0,
Thanks for getting back to me.
I also tracked this issue on the Rollup repo, where the maintainer tracked it down to the usage of SWC.
rollup/rollup#5304

He suggested to try to use npm overrides to exchange rollup with @rollup/wasm-node.
But I had no success with this due to peer dependencies, even though it should be a drop-in replacement.
Do you have an idea if I did my overrides correct?
rollup/rollup#5304 (comment)

Is there a world where Nitro will not use the SWC version, but the WebAssembly one, maybe through config?

I think we can close this issue here.

@pi0
Copy link
Member

pi0 commented Dec 21, 2023

Thanks for confirming and linking. You can use resolutions field in package.json (works with pnpm, yarn and recent npm, alternatively you can use overrides if not works) to pin to use wasm version of SWC:

  "resolutions": {
    "rollup": "npm:@rollup/wasm-node"
  },
  "overrides": {
    "rollup": "npm:@rollup/wasm-node"
  },

@fabianwohlfart
Copy link
Author

Thanks.
I was actually aware of this, but was using the resolutions wrong:
Instead of "rollup": "npm:@rollup/wasm-node" I used "rollup": "@rollup/wasm-node".
Your hint with the npm: was the case solver.
Thank you for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants