N
Nuxt2mo ago
Xander

tailwind 4

I am trying to add tailwind to my project. i keep getting this: Cannot find module '~/assets/css/main.css' #❓・help
No description
No description
2 Replies
kapa.ai
kapa.ai2mo ago
Hi @Xander. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error "Cannot find module '~/assets/css/main.css'" usually means that Nuxt cannot locate the CSS file at the specified path. In Nuxt 4, the correct directory for assets is /app/assets/, so your CSS file should be at app/assets/css/main.css (not just assets/css/main.css at the project root). The ~ alias in Nuxt 4 points to /app, so ~/assets/css/main.css resolves to app/assets/css/main.css Update v4 Documentation /app/assets UI. How to fix: 1. Check your file location:
Make sure your main.css file is at app/assets/css/main.css. 2. Reference it in your config:
In your nuxt.config.ts, use:
export default defineNuxtConfig({
css: ['~/assets/css/main.css']
})

export default defineNuxtConfig({
css: ['~/assets/css/main.css']
})

This will include your CSS globally Styling in Nuxt 4. 3. Restart your dev server:
Sometimes, Nuxt needs a restart to pick up new files. If you still get the error, double-check the file path and spelling. If your project structure is correct and the file exists, Nuxt should find it. Let me know if you need more help! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@849415792529244170> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?