c12: installing deps from a layer contains a pnpm version mismatch

Environment

  • pnpm: 9.0.5
  • node: v20.11.1

Reproduction

Stackblitz isn’t letting me extend from a github repo, but this is the layer I’m extending from, with this nuxt.config.ts in the destination being:

export default defineNuxtConfig({
  devtools: { enabled: true },
  extends: [
    ['gh:sandros94/ui#f77b037', { install: true }],
  ],
})

Describe the bug

The source pnpm-lock.yaml is version 9.0, but the c12 provided one is lockfileVersion: '6.0'.

Additional context

Testing out Nuxt compatibility 4 with nuxt@3.12 I do get the error in the console, but it seems to be installing the packages correctly.

Logs

Ignoring broken lockfile at A:\github\sandros94\s94.dev\node_modules\.c12\gh_sandros94_ui_qnPJOddopC: Lockfile A:\github\sandros94\s94.dev\node_modules\.c12\gh_sandros94_ui_qnPJOddopC\pnpm-lock.yaml not compatible with current pnpm 

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

Thanks for all the details and followups ❤️

I think we can safely track the c12 relevant part from https://github.com/unjs/c12/issues/128

If i could help on any of Nuxt relevant issues (or discord!) please ping me 🙏🏼

@BobbieGoede the layer seems to be https://github.com/Sandros94/ui, and @nuxtjs/tailwindcss would be added by @nuxt/ui, so it’s reasonable for @nuxt/ui to be installed first.

Lets discuss this on Discord right now if you’re all on?

I suspect some of the things you are mentioning are not directly c12 issues (or this issue at least) anymore…

Indeed the type issue wasn’t related, sorry for the spam.

Do you think you can help on making a c12-only reproduction for pnpm issues and we can track others via nuxt repo maybe? (if it is hard no worries)

Indeed I’m not sure where to start in creating a c12-only (or any unjs-only for what matters) repro, since I started learning js/ts and package managers only with Nuxt. BUT I’m willing to learn on creating such repro and help debug this. Although I’m starting to think that this is not related only to pnpm, since bun also produce the same outcome. That what to me it seems (with the layer being in a sub-dir now):

  • layer’s deps get correctly installed in lockfile inside the sub c12 folder (but not top-level node_modules)
  • the ts logics from those deps is loaded (for example tailwind styles and fonts are loaded once dev is started)
  • components from those deps aren’t loaded (for example any component from nuxt/ui isn’t working)
  • components form the layer itself are loaded (since I do see tailwinds classes getting applied to those components)

Ok, first off thanks for the tip of moving it into a sub-dir (it was useless to pull dev files into production), but I’m not fully getting the expected result:

The setup to debug this is a c12-issue156 branch of my personal website repo, that extends my current ui/main layer.

  1. After pnpm i I do see deps getting installed in the logs (first deps are from the layer, the others from the local project): image
  2. checking the newly created pnpm-lock.yaml in the c12 layer I do see that lockfileVersion is still 6.0, although this time I didn’t get any errors from the first step (opposed to my original issue description)
  3. starting the dev server I do see correctly the content from the layer, but not from the modules within the layer (in fact looking at the folders inside node_modules I don’t see them installed, nor in the local pnpm-lock.yaml), they are just not installed and no error is thrown.

Just as an experiment I did test with bun but the same result is obtained

EDIT

I just noticed that nuxt@3.12.1 got released (and installed) it has nothing to do with it

Hi. This is somehow similar to #128 where pnpm picks workspace constraints.

I think a simple workaround (and better layer structure) if you cannot get rid of different lockfiles, is that in your layer, use a sub-directory (gh:sandros94/ui/theme) and inside sub-dir without lockfile. This pattern has more benefits that development files of layer won’t be pulled into the production layer