Skip to content

Layer with dependencies in monorepo goes in postinstall loop #33382

@NicolaSpadari

Description

@NicolaSpadari

Environment

  • Operating System: Darwin
  • Node Version: v22.20.0
  • Nuxt Version: 4.1.2
  • CLI Version: 3.28.0
  • Nitro Version: 2.12.6
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Describe the bug

I'm building a layer for the Nuxt UI with some customizations, so that i can extend the config as well as its dependencies from any nuxt 4 project.
In a normal Nuxt project works just fine, but when run in a pnpm workspace monorepo, the dependencies installation reaches the prepare step for the layer, which seems like to be detected as another package folder, and keeps triggering the prepare action, resulting in a postinstall loop.
I already tried removing the install: true option for the layer, but that just breaks the project as its dependencies are not found inside by nuxt project.
Manually installing the dependencies would work, but that defies the reason i'm using the layer to encapsulate all the ui configurations and dependencies.

Additional context

This layer configuration works just fine if the project doesn't have a pnpm-workspace file, and the installation in treated as normal folder. The bug only occurs when running inside a workspace

Logs

➜ pnpm install           
Scope: all 2 workspace projects
Lockfile is up to date, resolution step is skipped
Already up to date
apps/frontend postinstall$ nuxt prepare
│ Scope: all 2 workspace projects
│ ../../.. postinstall$ nuxt prepare
│ ../../.. postinstall: Scope: all 2 workspace projects
│ ../../.. postinstall: ../../.. postinstall$ nuxt prepare
│ ../../.. postinstall: ../../.. postinstall: Scope: all 2 workspace projects
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall$ nuxt prepare
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Scope: all 2 workspace projects
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall$ nuxt prepare
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Scope: all 2 workspace projects
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall$ nuxt prepare
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Scope: all 2 workspace projects
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall$ nuxt prep…
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Scope: al…
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. …
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. …
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Done in 7…
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Failed
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Done in 2s using pnpm v10.13.1
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Failed
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Done in 3.4s using pnpm v10.13.1
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Failed
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Done in 4.7s using pnpm v10.13.1
│ ../../.. postinstall: ../../.. postinstall: ../../.. postinstall: Failed
│ ../../.. postinstall: ../../.. postinstall: Done in 6.1s using pnpm v10.13.1
│ ../../.. postinstall: ../../.. postinstall: Failed
│ ../../.. postinstall: Done in 7.5s using pnpm v10.13.1
│ ../../.. postinstall: Failed
│ Done in 8.9s using pnpm v10.13.1
└─ Failed in 9.9s at /Users/administrator/Projects/nuxt-demo-monorepo-layer/apps/frontend
Done in 10.3s using pnpm v10.13.1

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions