reactjstailwind-cssshadcnuitailwind-css-4

Error: Cannot find module '../lightningcss.win32-x64-msvc.node'


i have tailwind, Reactjs project, and i installed shadcn, but i get this error:

failed to load config from C:\Users\user\Desktop\sann\ERP\vite.config.ts
error when starting dev server:
Error: Cannot find module '../lightningcss.win32-x64-msvc.node'
Require stack:
- C:\Users\user\Desktop\sann\ERP\node_modules\lightningcss\node\index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Module._load (node:internal/modules/cjs/loader:1051:27)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (C:\Users\user\Desktop\sann\ERP\node_modules\lightningcss\node\index.js:22:22)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at cjsLoader (node:internal/modules/esm/translators:346:17)

I tried all the solutions on the internet but the problem remained the same

Knowing that I use Vite


Solution

  • Keep in mind that TailwindCSS requires at least Node.js v20 to run.

    Install the latest Microsoft Visual C++ Redistributable version:

    Then restart your device, then again install TailwindCSS v4.0 and LightningCSS will work.