volta-cli / volta

Volta: JS Toolchains as Code. ⚡
https://volta.sh
Other
11.1k stars 235 forks source link

pnpm workspace not work #1593

Open NovaAstra opened 10 months ago

NovaAstra commented 10 months ago

Node: v18.17.0 (current @ D:\Nova\package.json) pnpm: v8.12.0 (current @ D:\Nova\package.json) Tool binaries available: pnpm, pnpx (default)

I turned on the experimental pnpm, set up the pnpm workspace according to the process, and set up the script command in the sub-project, but the root directory cannot run; I can't make it work; another problem is that I use volta install pnpm another After a version and pinned it, I went to pnpm run dev:vue, which prompted me another problem, such as the existence of volta was not the same as the new cache; here are some examples I can provide

https://github.com/NovaAstra/Nova

image image image image image

chriskrycho commented 10 months ago

The error output there is telling you that the problem is that you have specified an incompatible version of pnpm. 😅

ERR PNPM_ UNSUPPORTED ENGINE Unsupported environment (bad pnpm and/or Node.js version) Your pnpm version is incompatible with "D:\Nova".

Expected version: >=8.12.1
Got: 8.12.0 This is happening because the package's manifest has an engines.pnpm field specified.

To fix this issue, install the required pnpm version globally.

That means that the thing you are trying to run (presumably at D:\Nova, but possibly somewhere else in the monorepo or its packages) has something like this in its package.json:

{
  "engines": {
    "pnpm": ">=8.12.1"
  }
}

Beyond that, it is hard to say what was going on in the other problems you hit! If you can create an isolated reproduction of the problem, that would be helpful in debugging.


Additionally, please share actual code from the package.json files and so on rather than screenshots going forward, for two reasons:

  1. It makes it much easier for people to interact with, including to reproduce things.
  2. It makes it accessible to people who cannot see the screenshot and need to use a screenreader to understand the issue.

Thanks!

NovaAstra commented 10 months ago

https://github.com/NovaAstra/Nova/tree/pnpm

  1. Volta install pnpm@8.12.1
  2. Volta pin pnpm@8.12.1
  3. pnpm install
  4. pnpm dev: vue(success)
  5. Close vscode
  6. Volta install pnpm@8.12.0
  7. Volta pin pnpm@8.12.0 (I have maintained consistency in the versions of engines and volta in package.json)
  8. pnpm install (the above steps operate normally)
  9. pnpm dev: vue (error exception) pnpm@8.12.1 )

This is my simplest operation process, and what I am puzzled about is that even though I have changed the pnpm version and pin, it still prompts me that the pnpm is the same as last time