Skip to content

Using lightning with bun results in incorrect architecture selection #999

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

Open
FoxtrotPerry opened this issue Jun 3, 2025 · 0 comments
Open

Comments

@FoxtrotPerry
Copy link

Issue synopsis

I have a project running Next.js that is using tailwindcss v4 which includes lightningcss. When attempting to run my app, I'm given the following error:

 ⨯ ./src/styles/globals.css
Error evaluating Node.js code
Error: Cannot find module '../lightningcss.darwin-x64.node'
Require stack:
- /Users/foxtrotperry/Dev/todays-photo/node_modules/lightningcss/node/index.js
- /Users/foxtrotperry/Dev/todays-photo/node_modules/@tailwindcss/node/dist/index.js
- /Users/foxtrotperry/Dev/todays-photo/node_modules/@tailwindcss/postcss/dist/index.js
- /Users/foxtrotperry/Dev/todays-photo/.next/build/chunks/[turbopack]_runtime.js
- /Users/foxtrotperry/Dev/todays-photo/.next/transform.js
    [at Module._resolveFilename (node:internal/modules/cjs/loader:1219:15)]
    [at Module._load (node:internal/modules/cjs/loader:1045:27)]
    [at TracingChannel.traceSync (node:diagnostics_channel:315:14)]
    [at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)]
    [at Module.require (node:internal/modules/cjs/loader:1304:12)]
    [at require (node:internal/modules/helpers:123:16)]
    [at Object.<anonymous> (/Users/foxtrotperry/Dev/todays-photo/node_modules/lightningcss/node/index.js:24:22)]
    [at Module._compile (node:internal/modules/cjs/loader:1504:14)]
    [at Module._extensions..js (node:internal/modules/cjs/loader:1588:10)]
    [at Module.load (node:internal/modules/cjs/loader:1282:32)]

In my node modules, I'm seeing both expected packages for my system (arm64 macbook): lightningcss, and lightningcss-darwin-arm64. However, the error shows that on import, lightning attempted to load in lightningcss-darwin-x64 instead.

Investigation so far

A cursory check led me to this file where it seems that process.arch is somehow being set to x64. I'm not really sure how that's possible but that is indeed what is happening.

As a sanity check, I tried running the next js app with and without turbopack but that didn't change the error. I also tried bun -e "console.log(process.arch)" and as expected, it returned arm64.

Beyond this, I'm not really sure what to try and will likely be reverting to tailwindcss v3 until I have more time to investigate the issue further. However, let me know if there are any more details that would be helpful and I'll happily provide!

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

No branches or pull requests

1 participant