vitejs / vite

Next generation frontend tooling. It's fast!
http://vitejs.dev
MIT License
67.31k stars 6.05k forks source link

Windows + yarn pnp: [vite] Get yarn cache dir error: spawnSync C:\Windows\system32\cmd.exe ENOENT #18136

Open pwilkowski opened 2 days ago

pwilkowski commented 2 days ago

Describe the bug

When building angular app with their new build system application that is using vite i am getting following error

 [vite] Get yarn cache dir error: spawnSync C:\Windows\system32\cmd.exe ENOENT

While it is error in angular app, i tracked it down to vite repository:

https://github.com/vitejs/vite/blob/c1ed8a595a02ec7f8f5a8d23f97b2f21d3834ab1/packages/vite/src/node/server/index.ts#L1058

Reproduction

https://stackblitz.com/edit/stackblitz-starters-zk4gna

Steps to reproduce

It is not possible to reproduce in stackblitz because it does not support yarn pnp.

  1. Need to be on windows
  2. setup any 18+ angular app with ng new
  3. This should make use of yarn 4.5.0
    yarn set version stable
  4. create file .yarnrc.yml
  5. paste content
    nodeLinker: pnp
    enableGlobalCache: false
  6. yarn
  7. yarn start

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 104.85 GB / 127.93 GB
  Binaries:
    Node: 20.14.0 - C:\Programy\nodejs\node.EXE
    Yarn: 4.1.0 - C:\Programy\nodejs\yarn.CMD
    npm: 10.7.0 - C:\Programy\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527

Used Package Manager

yarn

Logs

No response

Validations

stackblitz[bot] commented 2 days ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.