Skip to content

GitHub Actions Linux fails to find module '../lightningcss.linux-x64-gnu.node' even though it works locally on mac #956

@Andrew-Chen-Wang

Description

@Andrew-Chen-Wang

Public reproduction: https://github.com/Andrew-Chen-Wang/template-nextjs

GitHub action: https://github.com/Andrew-Chen-Wang/template-nextjs/actions/runs/14348535357/job/40222977259

I've installed tailwind and vitest, and it seems like vite installed lightningcss. I'm on a mac (latest version, silicon), and running the production build command works fine. However, when running on Github actions on Linux, it fails.

Full traceback
> website@0.1.0 build
> next build
⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
   ▲ Next.js 15.2.5
   Creating an optimized production build ...
Failed to compile.
./src/app/globals.css.webpack[javascript/auto]!=!../../node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[2]!../../node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[3]!./src/app/globals.css
Error: Cannot find module '../lightningcss.linux-x64-gnu.node'
Require stack:
- /home/runner/work/template-nextjs/template-nextjs/node_modules/lightningcss/node/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/@tailwindcss/node/dist/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/@tailwindcss/postcss/dist/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/config/blocks/css/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/config/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack-config.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack-build/impl.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/jest-worker/processChild.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15)
    at /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/server/require-hook.js:55:36
    at Module._load (node:internal/modules/cjs/loader:1043:2[7](https://github.com/Andrew-Chen-Wang/template-nextjs/actions/runs/14348535357/job/40222977259#step:5:8))
    at Module.require (node:internal/modules/cjs/loader:1298:19)
    at mod.require (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/server/require-hook.js:65:28)
    at require (node:internal/modules/helpers:182:18)
    at Object.<anonymous> (/home/runner/work/template-nextjs/template-nextjs/node_modules/lightningcss/node/index.js:22:22)
    at Module._compile (node:internal/modules/cjs/loader:1529:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1613:[10](https://github.com/Andrew-Chen-Wang/template-nextjs/actions/runs/14348535357/job/40222977259#step:5:11))
    at Module.load (node:internal/modules/cjs/loader:1275:32)
Import trace for requested module:
./src/app/globals.css.webpack[javascript/auto]!=!../../node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[2]!../../node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[3]!./src/app/globals.css
./src/app/globals.css
./src/app/globals.css
Error: Cannot find module '../lightningcss.linux-x64-gnu.node'
Require stack:
- /home/runner/work/template-nextjs/template-nextjs/node_modules/lightningcss/node/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/@tailwindcss/node/dist/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/@tailwindcss/postcss/dist/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/config/blocks/css/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/config/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack-config.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack-build/impl.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/jest-worker/processChild.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:[12](https://github.com/Andrew-Chen-Wang/template-nextjs/actions/runs/14348535357/job/40222977259#step:5:13)12:15)
    at /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/server/require-hook.js:55:36
    at Module._load (node:internal/modules/cjs/loader:1043:27)
    at Module.require (node:internal/modules/cjs/loader:1298:19)
    at mod.require (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/server/require-hook.js:65:28)
    at require (node:internal/modules/helpers:182:18)
    at Object.<anonymous> (/home/runner/work/template-nextjs/template-nextjs/node_modules/lightningcss/node/index.js:22:22)
    at Module._compile (node:internal/modules/cjs/loader:1529:[14](https://github.com/Andrew-Chen-Wang/template-nextjs/actions/runs/14348535357/job/40222977259#step:5:15))
    at Module._extensions..js (node:internal/modules/cjs/loader:1613:10)
    at Module.load (node:internal/modules/cjs/loader:1275:32)
    at tryRunOrWebpackError (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:29:316142)
    at __webpack_require_module__ (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:29:13[15](https://github.com/Andrew-Chen-Wang/template-nextjs/actions/runs/14348535357/job/40222977259#step:5:16)48)
    at __nested_webpack_require_161494__ (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:29:130983)
    at /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:29:131840
    at symbolIterator (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/neo-async/async.js:1:14444)
    at done (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/neo-async/async.js:1:14824)
    at Hook.eval [as callAsync] (eval at create (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:14:9224), <anonymous>:15:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:14:6378)
    at /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:29:130703
    at symbolIterator (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/neo-async/async.js:1:14402)
-- inner error --
Error: Cannot find module '../lightningcss.linux-x64-gnu.node'
Require stack:
- /home/runner/work/template-nextjs/template-nextjs/node_modules/lightningcss/node/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/@tailwindcss/node/dist/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/@tailwindcss/postcss/dist/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/config/blocks/css/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/config/index.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack-config.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack-build/impl.js
- /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/jest-worker/processChild.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15)
    at /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/server/require-hook.js:55:36
    at Module._load (node:internal/modules/cjs/loader:1043:27)
    at Module.require (node:internal/modules/cjs/loader:1298:19)
    at mod.require (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/server/require-hook.js:65:28)
    at require (node:internal/modules/helpers:182:18)
    at Object.<anonymous> (/home/runner/work/template-nextjs/template-nextjs/node_modules/lightningcss/node/index.js:22:22)
    at Module._compile (node:internal/modules/cjs/loader:1529:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:[16](https://github.com/Andrew-Chen-Wang/template-nextjs/actions/runs/14348535357/job/40222977259#step:5:17)13:10)
    at Module.load (node:internal/modules/cjs/loader:1275:32)
    at Object.<anonymous> (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[2]!/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[3]!/home/runner/work/template-nextjs/template-nextjs/apps/website/src/app/globals.css:1:7)
    at /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:29:962742
    at Hook.eval [as call] (eval at create (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:14:9002), <anonymous>:7:1)
    at Hook.CALL_DELEGATE [as _call] (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:14:6272)
    at /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:29:131581
    at tryRunOrWebpackError (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:29:316096)
    at __webpack_require_module__ (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:29:131548)
    at __nested_webpack_require_161494__ (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:29:130983)
    at /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/webpack/bundle5.js:29:13[18](https://github.com/Andrew-Chen-Wang/template-nextjs/actions/runs/14348535357/job/40222977259#step:5:19)40
    at symbolIterator (/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/compiled/neo-async/async.js:1:14444)
Generated code for /home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[2]!/home/runner/work/template-nextjs/template-nextjs/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[3]!/home/runner/work/template-nextjs/template-nextjs/apps/website/src/app/globals.css
Import trace for requested module:
./src/app/globals.css
> Build failed because of webpack errors
npm error Lifecycle script `build` failed with error:
npm error code 1
npm error path /home/runner/work/template-nextjs/template-nextjs/apps/website
npm error workspace website@0.1.0
npm error location /home/runner/work/template-nextjs/template-nextjs/apps/website
npm error command failed
npm error command sh -c next build
Error: Process completed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions