Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle yarn command fail when root does not exist #18141

Conversation

sapphi-red
Copy link
Member

Description

Angular sets a path that doesn't exist to root.
https://github.com/angular/angular-cli/blob/ea4a125233c3ad9bc225e365b21a6b5d2d885720/packages/angular/build/src/builders/dev-server/vite-server.ts#L550-L553

That makes execSync to fail, because Windows requires cwd to exist.

const enableGlobalCache =
execSync('yarn config get enableGlobalCache', { cwd: root })
.toString()
.trim() === 'true'

This PR fixes that by using searchForPackageRoot(root) for cwd instead of root. But I'm not sure if we want to support this case.

fixes #18136

Copy link

stackblitz bot commented Sep 19, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@patak-dev patak-dev merged commit 460aaff into vitejs:main Oct 7, 2024
12 checks passed
@sapphi-red sapphi-red deleted the fix/handle-yarn-command-fail-root-not-exist branch October 8, 2024 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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