tailwindcss: Cannot destructure property 'nuxt' of 'this' as it is undefined.
Version
@nuxtjs/tailwindcss: 5.3.3 nuxt: 2.15.8 platform: Windows 11.
Reproduction Link
https://github.com/PawFV/platform-portal
Steps to reproduce
yarn install && yarn dev
What is Expected?
Project should start in development mode
What is actually happening?
FATAL Cannot destructure property 'nuxt' of 'this' as it is undefined. 11:14:20
at postcss8Module (node_modules\@nuxt\postcss8\dist\index.js:16:10)
at installModule (/C:/Users/paujo/platform-portal/node_modules/@nuxt/kit/dist/index.mjs:416:9)
at async setup (/C:/Users/paujo/platform-portal/node_modules/@nuxtjs/tailwindcss/dist/module.mjs:186:7)
at async ModuleContainer.normalizedModule (/C:/Users/paujo/platform-portal/node_modules/@nuxt/kit/dist/index.mjs:167:5)
at async ModuleContainer.addModule (node_modules\@nuxt\core\dist\core.js:239:20)
at async ModuleContainer.ready (node_modules\@nuxt\core\dist\core.js:51:7)
at async Nuxt._init (node_modules\@nuxt\core\dist\core.js:478:5)
╭─────────────────────────────────────────────────────────────────────────────────╮
│ │
│ ✖ Nuxt Fatal Error │
╰─────────────────────────────────────────────────────────────────────────────────╯
error Command failed with exit code 1.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 20
- Comments: 19
Just for confirmation, this error still exists in v6.2.0 when used with Nuxt2
My solution for now:
Downgrade to version 4.2.1.
yarn add @nuxtjs/tailwindcss@4.2.1temporarily solved by using
overridesproperty.npm version >= 8.3
For yarn users please use in your package.json
This is workaround and works, but this is not a solution.
"overrides"is easy to setup in when you have access to package.json, but what about libraries that use nuxt/tailwind module as dependency ? There is no way to setupoverrides. Even if we force"@nuxt/kit": "3.0.0-rc.13"as dependency in the library. According to the documentation this module should works with nuxt2, but the problem is still there.In case anyone needs the npm equivalent. It resolves the issue for now (nuxt 2.15.8, tailwind 6.2.0)
By this action you will downgrade to tailwind v2, and it may cause some error, as it did in my project.