Skip to content

Error: Cannot find module '../lightningcss.linux-x64-musl.node' #17958

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
therealsras opened this issue May 9, 2025 · 12 comments
Open

Error: Cannot find module '../lightningcss.linux-x64-musl.node' #17958

therealsras opened this issue May 9, 2025 · 12 comments
Labels

Comments

@therealsras
Copy link

Image I had workaround working. but I see it will solve this but no.
#37 3.296 > next build
#37 3.296
#37 4.772    ▲ Next.js 15.3.1
#37 4.773    - Environments: .env.production
#37 4.840    Creating an optimized production build ...
#37 59.97 Failed to compile.
#37 59.97
#37 59.98 app/layout.tsx
#37 59.98 An error occurred in `next/font`.
#37 59.98
#37 59.98 Error: Cannot find module '../lightningcss.linux-x64-musl.node'
#37 59.98 Require stack:
#37 59.98 - /app/node_modules/lightningcss/node/index.js
#37 59.98 - /app/node_modules/@tailwindcss/node/dist/index.js
#37 59.98 - /app/node_modules/@tailwindcss/postcss/dist/index.js
#37 59.98 - /app/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
#37 59.98 - /app/node_modules/next/dist/build/webpack/config/blocks/css/index.js
#37 59.98 - /app/node_modules/next/dist/build/webpack/config/index.js
#37 59.98 - /app/node_modules/next/dist/build/webpack-config.js
#37 59.98 - /app/node_modules/next/dist/build/webpack/plugins/next-trace-entrypoints-plugin.js
#37 59.98 - /app/node_modules/next/dist/build/collect-build-traces.js
#37 59.98 - /app/node_modules/next/dist/build/index.js
#37 59.98 - /app/node_modules/next/dist/cli/next-build.js
#37 59.98     at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
#37 59.98     at /app/node_modules/next/dist/server/require-hook.js:55:36
#37 59.98     at Module._load (node:internal/modules/cjs/loader:981:27)
#37 59.98     at Module.require (node:internal/modules/cjs/loader:1231:19)
#37 59.98     at mod.require (/app/node_modules/next/dist/server/require-hook.js:65:28)
#37 59.98     at require (node:internal/modules/helpers:177:18)
#37 59.98     at Object.<anonymous> (/app/node_modules/lightningcss/node/index.js:22:22)
#37 59.98     at Module._compile (node:internal/modules/cjs/loader:1364:14)
#37 59.98     at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
#37 59.98     at Module.load (node:internal/modules/cjs/loader:1203:32)
#37 59.98
#37 59.98 lib/fonts.ts
#37 59.98 An error occurred in `next/font`.
#37 59.98
#37 59.98 Error: Cannot find module '../lightningcss.linux-x64-musl.node'
#37 59.98 Require stack:
#37 59.98 - /app/node_modules/lightningcss/node/index.js
#37 59.98 - /app/node_modules/@tailwindcss/node/dist/index.js
#37 59.98 - /app/node_modules/@tailwindcss/postcss/dist/index.js
#37 59.98 - /app/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
#37 59.98 - /app/node_modules/next/dist/build/webpack/config/blocks/css/index.js
#37 59.98 - /app/node_modules/next/dist/build/webpack/config/index.js
#37 59.98 - /app/node_modules/next/dist/build/webpack-config.js
#37 59.98 - /app/node_modules/next/dist/build/webpack/plugins/next-trace-entrypoints-plugin.js
#37 59.98 - /app/node_modules/next/dist/build/collect-build-traces.js
#37 59.98 - /app/node_modules/next/dist/build/index.js
#37 59.98 - /app/node_modules/next/dist/cli/next-build.js
#37 59.98     at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)
#37 59.98     at /app/node_modules/next/dist/server/require-hook.js:55:36
#37 59.98     at Module._load (node:internal/modules/cjs/loader:981:27)
#37 59.98     at Module.require (node:internal/modules/cjs/loader:1231:19)
#37 59.98     at mod.require (/app/node_modules/next/dist/server/require-hook.js:65:28)
#37 59.98     at require (node:internal/modules/helpers:177:18)
#37 59.98     at Object.<anonymous> (/app/node_modules/lightningcss/node/index.js:22:22)
#37 59.98     at Module._compile (node:internal/modules/cjs/loader:1364:14)
#37 59.98     at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
#37 59.98     at Module.load (node:internal/modules/cjs/loader:1203:32)
#37 59.98
#37 59.98
#37 59.98 > Build failed because of webpack errors
#37 60.14 npm notice
#37 60.14 npm notice New major version of npm available! 10.8.2 -> 11.3.0
#37 60.14 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.3.0
#37 60.14 npm notice To update run: npm install -g npm@11.3.0
#37 60.14 npm notice
#37 ERROR: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1

------
> [web-app-dev builder 5/5] RUN npm run build:
59.98     at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
59.98     at Module.load (node:internal/modules/cjs/loader:1203:32)
59.98
59.98
59.98 > Build failed because of webpack errors
60.14 npm notice
60.14 npm notice New major version of npm available! 10.8.2 -> 11.3.0
60.14 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.3.0
60.14 npm notice To update run: npm install -g npm@11.3.0
60.14 npm notice
------
failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1
Error ❌ failed to solve: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1

What version of Tailwind CSS are you using?

For example: v4.1.6

What build tool (or framework if it abstracts the build tool) are you using?

For example: Next.js 15.3.1

What version of Node.js are you using?
dockerfile: node:18-alpine

For example: Chrome, Safari, or N/A
Ubuntu Docker

@therealsras
Copy link
Author

#15806

@philipp-spiess
Copy link
Member

Hey! Yeah this is expected, we can only fix this for our native extension but your bundler still has issues it seems. In the thread #15806 some folks have had issues with only our binary so we still went ahead with this fix.

I suggest you add the necessary dependency for lightningcss.linux-x64-musl.node manually or update npm to the latest version, see: #15806 (comment)

@philipp-spiess
Copy link
Member

philipp-spiess commented May 9, 2025

Can you clarify what you mean by:

I had workaround working. but I see it will solve this but no.

I wouldn't expect our workaround to make your workaround worse.

@therealsras
Copy link
Author

@philipp-spiess are you saying to upgrade npm version in dockerfile. I can build successfully on Mac Arm. but docker could not

sample from dockerfile

FROM node:18-alpine AS deps

@therealsras
Copy link
Author

Hey! Yeah this is expected, we can only fix this for our native extension but your bundler still has issues it seems. In the thread #15806 some folks have had issues with only our binary so we still went ahead with this fix.

I suggest you add the necessary dependency for lightningcss.linux-x64-musl.node manually or update npm to the latest version, see: #15806 (comment)

are you meaning to keep the optionalDependencies as it was.

@philipp-spiess
Copy link
Member

@philipp-spiess are you saying to upgrade npm version in dockerfile. I can build successfully on Mac Arm. but docker could not

Regardless of the issue I'd recommend that, yes, Node 18 is no longer receiving updates and is "end of life" for example. But that might be a larger change based on what Node APIs you're using

are you meaning to keep the optionalDependencies as it was.

If it worked before then yes, keep it. You should be able to remove the ones oxide and only leave the ones for lightningcss inside.

@therealsras
Copy link
Author

oxide

okay. upgrade node version won't fix this right?

and what 4.1.6 fixed is we can remove ones oxide not lightningcss, and will it also be fixed?

@philipp-spiess
Copy link
Member

okay. upgrade node version won't fix this right?

You will need the latest npm version, I don't know if it will work with older node versions. See https://github.com/npm/cli/releases/tag/v11.3.0

and what 4.1.6 fixed is we can remove ones oxide not lightningcss, and will it also be fixed?

Yeah, Oxide is the library we maintain, Lightningcss is a third-party library so it is not as easy to apply the fix. We might have to add something in the future but ideally this can be fixed upstream. I want to wait first and see if our fix has helped at least somewhat.

Are you able to get it working by adding back only this part?

Image

@therealsras
Copy link
Author

okay. upgrade node version won't fix this right?

You will need the latest npm version, I don't know if it will work with older node versions. See https://github.com/npm/cli/releases/tag/v11.3.0

and what 4.1.6 fixed is we can remove ones oxide not lightningcss, and will it also be fixed?

Yeah, Oxide is the library we maintain, Lightningcss is a third-party library so it is not as easy to apply the fix. We might have to add something in the future but ideally this can be fixed upstream. I want to wait first and see if our fix has helped at least somewhat.

Are you able to get it working by adding back only this part?

Image

Thank you. yes, adding it back, it works.

Image

@therealsras
Copy link
Author

@philipp-spiess if trying lastest npm it will causes problem


#33 [web-app-dev deps 3/6] RUN npm install -g npm@latest
#33 2.860 npm error code EBADENGINE
#33 2.861 npm error engine Unsupported engine
#33 2.861 npm error engine Not compatible with your version of node/npm: npm@11.3.0
#33 2.861 npm error notsup Not compatible with your version of node/npm: npm@11.3.0
#33 2.861 npm error notsup Required: {"node":"^20.17.0 || >=22.9.0"}
#33 2.861 npm error notsup Actual:   {"npm":"10.8.2","node":"v18.20.8"}
#33 2.862 npm error A complete log of this run can be found in: /root/.npm/_logs/2025-05-09T14_54_01_686Z-debug-0.log
#33 ERROR: process "/bin/sh -c npm install -g npm@latest" did not complete successfully: exit code: 1

@philipp-spiess
Copy link
Member

@thatguychrisw yeah seems like it doesn't work with Node 18 anymore. Maybe you can try using node 20 and see if that works? Would be awesome to get confirmation that the npm bugfix actually resolves this issue!

@therealsras
Copy link
Author

@thatguychrisw yeah seems like it doesn't work with Node 18 anymore. Maybe you can try using node 20 and see if that works? Would be awesome to get confirmation that the npm bugfix actually resolves this issue!

yes, right node 20 can build successfully. just there are some warning as below.


#38 DONE 0.1s
#39 [web-app-dev deps 6/6] RUN npm install --omit-dev
#39 0.667 npm warn Unknown cli config "--omit-dev". This will stop working in the next major version of npm.
#39 7.304 npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
#39 7.803 npm warn deprecated npmlog@5.0.1: This package is no longer supported.
#39 9.339 npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
#39 9.919 npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
#39 10.03 npm warn deprecated gauge@3.0.2: This package is no longer supported.
#39 13.67 npm warn deprecated are-we-there-yet@2.0.0: This package is no longer supported.

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

No branches or pull requests

2 participants