Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Nuxt 4.6.0 prompts to install `tailwindcss/nesting` when using pnpm

未关闭
#1,047 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
58/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
nuxt, tailwindcss, typescript
领域
build-system

调研方向

Start by tracing where this module adds tailwindcss/nesting to Nuxt's PostCSS plugins, then inspect the Nuxt build behavior described in the report. Reproduce with Nuxt 4.6.0+, pnpm, and the documented module configuration; compare with Nuxt 4.5.2 if needed. Done means builds and generates no longer prompt to install the subpath when Tailwind CSS is installed.

由索引模型根据 Issue 内容生成。

描述

bug
Environment
- **Nuxt Version:** `4.6.0` (with `future: { compatibilityVersion: 4 }`)
- **@nuxtjs/tailwindcss Version:** `^6.14.0` (or `6.x`)
- **Package Manager:** `pnpm` (tested on `12.x` / strict `node_modules`)
- **OS:** Linux
Reproduction
  1. Create a Nuxt 4 project (or Nuxt with compatibilityVersion: 4 on nuxt@^4.6.0).

  2. Install dependencies with pnpm:
    pnpm add -D @nuxtjs/tailwindcss

  3. Add @nuxtjs/tailwindcss to modules in nuxt.config.ts.

  4. Run pnpm run build or pnpm run generate.

Describe the bug

When running nuxt build or nuxt generate on Nuxt 4.6.0+ using pnpm, Nuxt halts execution and displays an interactive prompt asking to install tailwindcss/nesting:

 ❯ Do you want to install `tailwindcss/nesting`?

In CI/CD environments (or non-interactive shells), this causes the build to fail.

Additional context
  1. @nuxtjs/tailwindcss injects 'tailwindcss/nesting': {} into the PostCSS plugins by default.
  2. Starting in Nuxt 4.6.0, Nuxt's Vite builder introduced ensureDependencyInstalled(pluginName) to automatically detect missing PostCSS plugins and prompt the user to install them.
  3. Because 'tailwindcss/nesting' is a subpath export of the tailwindcss package rather than a standalone npm package, Nuxt fails to resolve it as an installed package—especially under pnpm's strict dependency isolation—mistakenly treating it as a missing dependency.
Expected Behavior

The build should complete without prompting to install tailwindcss/nesting, as tailwindcss is already installed and tailwindcss/nesting is part of it.

Current Workarounds
  1. Explicitly disable the plugin in nuxt.config.ts:
    export default defineNuxtConfig({
      postcss: {
        plugins: {
          'tailwindcss/nesting': false,
        },
      },
    })
  1. Or pin Nuxt to version ~4.5.2.
Suggestions

• Check whether tailwindcss is already resolved before registering 'tailwindcss/nesting', or pass the resolved function reference instead of the string name.
• Alternatively, coordinate with the Nuxt core team regarding how ensureDependencyInstalled handles subpath imports in PostCSS plugin definitions.

主要语言
TypeScript
星标
1.9k
派生
193
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nuxt-modules/tailwindcss 的其他 Issue

查看 nuxt-modules/tailwindcss 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。