[nuxi][pnpm] nuxi module add error due to package manager conflict
Closed this issue · 9 comments
I used pnpm to add a new module pnpx nuxi@latest module add @pinia/nuxt
, and I got error Usage Error: This project is configured to use yarn
. ERROR Command failed with exit code 1: corepack pnpm add -D @pinia/nuxt@latest
.
The module was successfully added to the modules array in nuxt.config.ts, but it wasn't installed due to the package manager conflict.
The project has a pnpm-lock.yaml and the deps were installed with pnpm install
and the project created with pnpx nuxi@latest init <name>
, and finally executed pnpx nuxi@latest upgrade --force
.
Could it be possible you were previously using yarn or tried to install with an older version of cli? Is it still reproducible?
Could it be possible you were previously using yarn or tried to install with an older version of cli? Is it still reproducible?
Thanks for replying. I just removed Yarn from Windows 11, reloaded VSCode. Same error.
(got sure Yarn is not available)
More info:
Even though I had Yarn installed, I never use it, so I can't understand why I get an error regarding a package manager that I don't use, and didn't use to install the deps of this project. 🤔
Edit: I have these scripts to cleanup my projects, before submitting an issue, to rule out issues with dependencies.
"postclean": "pnpm install && pnpx nuxi@latest upgrade --force", "clean": "pnpx rimraf node_modules .nuxt pnpm-lock.yaml && pnpm postclean"
Update 2
Closed EVERYTHING. Created a new project, in the root directory of all my TypeScript projects called test-nuxt
with pnpx nuxi@latest init text-nuxt
.
Then pnpx nuxi@latest upgrade --force
.
Finally, pnpx nuxi@latest module add @pinia/nuxt
, and yarn error again...
Edit: Had an idea. Gonna restart Windows.
Edit 2: False alarm. Restarted Windows. Error continues...
Edit 3: Apparently is a Windows only issue.... Repro: https://stackblitz.com/edit/stackblitz-starters-orsppl?file=README.md
It is likely that you have a yarn.lock
somewhere in your home folder or upper-level directories. Would it still happen if you add "packageManager": "pnpm@8.7.6",
to your package.json
?
Solved
There was a .yarn directory in my user profile, but after deleting it, the error continued, and it should not conflict because this is the Yarn CLI configuration directory that remained after I uninstalled Yarn, not a Node project package manager file per se.
So the only files that I found and deleted to get it working, a .nuxtrc, a .yarnrc (not yarn.lock), a .vuerc, and a .npmrc. 🤷♂️😵💫
This is the 2nd time I have an issue with Nuxt (not with NestJS, or vanilla typescript projects), where having a node_modules (or in this case a package manager lock file or .*rc file) in the root of the projects directory, or in the user profile directory, causes an error. So weird...
Thanks for info. Yes there are two (unrelated) issues we are also aware of one with sibling upper node_modules
(mlly) and one with this wrongly auto detection (nypm).
Thanks for info. Yes there are two (unrelated) issues we are also aware of one with sibling upper
node_modules
(mlly) and one with this wrongly auto detection (nypm).
Thank you very much for your time, energy, and information provided. Have a nice rest of the day!