nuxt ui and nuxt ui-pro with nuxt 4 compatibility
has anyone else got nuxt ui to work with nuxt 4?
i assumed since nuxt 4 is so close that nuxt ui would work but i am getting a few error:
and
8 Replies
Hi @thejacer87. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources, Nuxt UI and Nuxt UI Pro are designed to work with Nuxt 3 and have recently adopted Tailwind CSS v4, which uses a CSS-first configuration approach. For Nuxt 4 compatibility, you should ensure the following:
1. Tailwind CSS v4: Nuxt UI v3 and Nuxt UI Pro v3 require Tailwind CSS v4. You should not use Tailwind CSS v3.x, as shown in your error logs. Make sure your
Theme Customization 2. Directory Structure: With Nuxt 4 compatibility, your assets should be in the
GitHub Issue: Nuxt 4 Compatibility 3. Remove Old Tailwind Config: Tailwind v4 with Nuxt UI v3+ no longer uses a
Migration Guide 4. Upgrade All Packages: Ensure you are using the latest versions of
Nuxt UI and Nuxt UI Pro v3+ are compatible with Nuxt 4 (compatibility mode) as long as you use Tailwind CSS v4, update your directory structure, and follow the new CSS-first theming approach. Double-check your package versions and configuration files to resolve the errors you are seeing. If you follow the official migration and installation guides, Nuxt UI should work with Nuxt 4 compatibility mode. If you still encounter issues, ensure all dependencies are up to date and your configuration matches the latest documentation. Nuxt UI Pro Installation Guide
Migration Guide
Theme Customization
GitHub Issue: Nuxt 4 Compatibility ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
main.css
(or equivalent) imports Tailwind CSS and the correct Nuxt UI package:
And in your nuxt.config.ts
:
Nuxt UI Pro Installation GuideTheme Customization 2. Directory Structure: With Nuxt 4 compatibility, your assets should be in the
app/assets/
directory, and you should use the future: { compatibilityVersion: 4 }
flag in your config. The ~
alias resolves to your srcDir
, which is app/
by default in Nuxt 4 mode.GitHub Issue: Nuxt 4 Compatibility 3. Remove Old Tailwind Config: Tailwind v4 with Nuxt UI v3+ no longer uses a
tailwind.config.ts
file. All theming is done via the @theme
directive in your CSS.Migration Guide 4. Upgrade All Packages: Ensure you are using the latest versions of
@nuxt/ui
or @nuxt/ui-pro
and Tailwind CSS v4. If you see errors referencing Tailwind v3, you likely have an old version installed.
5. Error: Unknown word "use strict": This error typically means you are using an incompatible version of Tailwind CSS (v3.x) with Nuxt UI v3, which expects v4. Upgrade Tailwind CSS to v4.
6. Error: Cannot read properties of undefined (reading 'theme'): This may occur if the theme configuration is missing or not set up correctly. Ensure you are using the new CSS-first theming approach and not relying on a removed tailwind.config.ts
.
Summary:Nuxt UI and Nuxt UI Pro v3+ are compatible with Nuxt 4 (compatibility mode) as long as you use Tailwind CSS v4, update your directory structure, and follow the new CSS-first theming approach. Double-check your package versions and configuration files to resolve the errors you are seeing. If you follow the official migration and installation guides, Nuxt UI should work with Nuxt 4 compatibility mode. If you still encounter issues, ensure all dependencies are up to date and your configuration matches the latest documentation. Nuxt UI Pro Installation Guide
Migration Guide
Theme Customization
GitHub Issue: Nuxt 4 Compatibility ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@291389486720352266> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai
i have followed the upgrade guides and there is no mention of how to make sure tailwind is up to date, here is my package.json and nuxt.config.ts
Let me check the knowledge base for you again. One moment! :books:
----------------------
To ensure Tailwind CSS is up to date and compatible with Nuxt UI Pro v3 and Nuxt 4 compatibility mode, you need to explicitly install Tailwind CSS v4 as a dependency in your project. The upgrade and installation guides for Nuxt UI Pro and Nuxt UI mention that Tailwind CSS v4 is required, but they do not always show the exact command to install or upgrade Tailwind CSS in your
Run the following command in your project directory to add the latest Tailwind CSS v4: or, if you use pnpm: 2. Verify your
After installing, your
Tailwind CSS v4 with Nuxt UI Pro v3 uses a CSS-first configuration. You should remove any
Your
The knowledge sources confirm that Tailwind CSS v4 is required, but do not provide a direct installation command. You must manually install or upgrade Tailwind CSS to v4 in your project to avoid the errors you are seeing and ensure compatibility with Nuxt UI Pro v3 and Nuxt 4 mode Theme Customization Migration Guide. If you still see errors after this, double-check that no old Tailwind config files remain and that your
package.json
Theme Customization Migration Guide.
What you should do:
1. Install Tailwind CSS v4Run the following command in your project directory to add the latest Tailwind CSS v4: or, if you use pnpm: 2. Verify your
package.json
After installing, your
package.json
should include something like:
3. Remove old Tailwind config (if present)Tailwind CSS v4 with Nuxt UI Pro v3 uses a CSS-first configuration. You should remove any
tailwind.config.js
or tailwind.config.ts
files and instead use the @theme
directive in your CSS, as shown in the docs Theme Customization.
4. Import Tailwind in your CSSYour
assets/css/main.css
should look like:
Summary:The knowledge sources confirm that Tailwind CSS v4 is required, but do not provide a direct installation command. You must manually install or upgrade Tailwind CSS to v4 in your project to avoid the errors you are seeing and ensure compatibility with Nuxt UI Pro v3 and Nuxt 4 mode Theme Customization Migration Guide. If you still see errors after this, double-check that no old Tailwind config files remain and that your
main.css
is correctly set up.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@291389486720352266> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai seems strange to have to manually install tailwind, there is no mention of it in the nuxt ui install docs.
also, now i get this error:
Let me check the knowledge base for you again. One moment! :books:
----------------------
You're correct that the Nuxt UI and Nuxt UI Pro installation guides do not explicitly mention the need to manually install Tailwind CSS as a dependency. However, they do state that Nuxt UI is designed to work with Tailwind CSS v4 and show examples where
@import "tailwindcss";
is used in your CSS files. They also mention that if you're using pnpm, you should ensure tailwindcss
is installed in your project's root directory, but the guides do not provide a direct installation command or clarify whether Tailwind is auto-installed by the module Nuxt UI Pro Installation Guide.
Regarding the error:
The knowledge sources do not mention this error or the need to install @tailwindcss/postcss
. They also do not provide any guidance on updating the PostCSS configuration for Tailwind CSS v4 in the context of Nuxt UI or Nuxt UI Pro. The official docs focus on the CSS-first configuration and using the @theme
directive, and do not reference any manual PostCSS plugin setup or this new package.
If you are seeing this error, it is likely due to a recent change in Tailwind CSS v4's integration with PostCSS, but the Nuxt UI documentation has not yet been updated to address this scenario. At this time, there is no explicit information in the provided knowledge sources about how to resolve this error within a Nuxt UI or Nuxt UI Pro project.
If you need further help, you may want to check the official Tailwind CSS documentation or open an issue with the Nuxt UI team, as this appears to be a gap in the current documentation.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@291389486720352266> Kapa.ai is still learning and improving, please let me know how I did by reacting below.