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)
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/tailwindcsswould be added by@nuxt/ui, so it’s reasonable for@nuxt/uito be installed first.Lets discuss this on Discord right now if you’re all on?
Indeed the type issue wasn’t related, sorry for the spam.
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):
node_modules)devis started)nuxt/uiisn’t working)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-issue156branch of my personal website repo, that extends my current ui/main layer.pnpm iI do see deps getting installed in the logs (first deps are from the layer, the others from the local project):pnpm-lock.yamlin the c12 layer I do see that lockfileVersion is still6.0, although this time I didn’t get any errors from the first step (opposed to my original issue description)node_modulesI don’t see them installed, nor in the localpnpm-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 thatit has nothing to do with itnuxt@3.12.1got released (and installed)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