Module package not found: @tailwindcss/vite. What is the possible cause? while deploying on vercel

i dont know what went wrong, have been trying to deploy to vercel but what i keep getting is package not found which is related to vite on react

failed to load config from /vercel/path0/vite.config.jserror when starting dev server:Error \[ERR_MODULE_NOT_FOUND\]: Cannot find package ‘@tailwindcsstailwindcsstailwindcsstailwindcsstailwindcsstailwindcsstailwindcsstailwindcss/vite’ imported from /vercel/path0/node_modules/.vite-temp/vite.config.js.timestamp-1764666607979-281cc1632e3e2.mjsat Object.getPackageJSONURL (node:internal/modules/package_json_reader:316:9)at packageResolve (node:internal/modules/esm/resolve:768:81)at moduleResolve (node:internal/modules/esm/resolve:858:18)at defaultResolve (node:internal/modules/esm/resolve:990:11)at #cachedDefaultResolve (node:internal/modules/esm/loader:737:20)at ModuleLoader.resolve (node:internal/modules/esm/loader:714:38)at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:293:38)at #link (node:internal/modules/esm/module_job:208:49)Error: Command “npm run dev” exited with 1
{“name”: “my-react-app”,“private”: true,“version”: “0.0.0”,“type”: “module”,“scripts”: {“dev”: “vite”,“build”: “vite build”
vite.config.jsimport { define@tailwindcssonfig } from ‘v@vitej@vitej@vitej@vitej@vitej@vitej@vitej@vitejsvite@vitej@vitejsste’import react from ‘@vitejs/plugin-react’i@tailwindcs@tailwindcs@tailwindcs@tailwindcs@tailwindcs@tailwindcs@tail@tailwindcssindcs@tailwindcs@tailwindcs@tailwindcssport tailwindcss from ‘@tailwindcss/vite’// https://vite.dev/config/export default defineConfig({plugins: \[react(),tailwindcss(),\]})

not finding tailwindcss/vite

react, vite and tailwindcss

Looking at your error, it seems like there’s a corrupted import in your vite.config.js file. The error shows repeated @tailwindcss text which suggests the file got mangled somehow.

Here’s how to fix it:

Fix your vite.config.js

Replace your current vite.config.js with this clean version:

import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import tailwindcss from '@tailwindcss/vite' // https://vite.dev/config/ export default defineConfig({ plugins: [ react(), tailwindcss(), ], })

Install the correct Tailwind CSS package

Make sure you have the right Tailwind CSS Vite plugin installed:

npm install -D @tailwindcss/vite

Alternative approach

If you’re still having issues, you can use the traditional Tailwind setup instead:

  1. Install Tailwind the standard way:

npm install -D tailwindcss postcss autoprefixer npx tailwindcss init -p

  1. Update your vite.config.js to:

import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' export default defineConfig({ plugins: [react()], })

  1. Add Tailwind directives to your CSS file:

@tailwind base; @tailwind components; @tailwind utilities;

The corrupted file is likely causing the module resolution issues you’re seeing.

2 Likes

I think he has done those I guess according to the latest chat in here.

I think you can take some idea from here.

If it not done, can I see the repo once to get the error that might be there?

2 Likes

{

“rewrites”: [

{ "source": "/(.\*)", "destination": "/" }

]

}
add vercel.json file in your project