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

[Regression (beta.57) - Yarn 2 PnP] -Start vite in dev throw error. #1813

Closed
hlege opened this issue Jan 30, 2021 · 4 comments
Closed

[Regression (beta.57) - Yarn 2 PnP] -Start vite in dev throw error. #1813

hlege opened this issue Jan 30, 2021 · 4 comments

Comments

@hlege
Copy link

hlege commented Jan 30, 2021

Describe the bug

From beta.57 starting vite in dev mode throw an error. It works in beta.56. The bug still present in beta.59.

Reproduction

  • npm init @vitejs/app runtime -- --template react
  • cd runtime
  • upgrade vite version in package.json
  • yarn install
  • yarn dev

System Info

  • vite version: beta.59
  • Operating System: Windows
  • Node version: v12
  • Package manager (npm/yarn/pnpm) and version: Yarn 2 PnP

Logs (Optional if provided reproduction)

Pre-bundling dependencies:
  react
  react-dom
(this will be run only when your dependencies or config have changed)
 > dep:react-dom: error: Could not resolve "../.yarn/$$virtual/react-dom-virtual-b6e8a2f47c/0/cache/react-dom-npm-17.0.1-588d0088ca-6a70028fbe.zip/node_modules/react-dom/index.js"
    1 │ import d from "../.yarn/$$virtual/react-dom-virtual-b6e8a2f47c/0/cache/react-dom-npm-17.0.1-588d0088ca-6a70028fbe.zip/node_modules/react-dom/index.js";export default d;
      ╵               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > error: Cannot read directory "../.yarn/cache/react-npm-17.0.1-98658812fc-a76d86ec97.zip": not a directory

 > dep:react: error: Could not resolve "../.yarn/cache/react-npm-17.0.1-98658812fc-a76d86ec97.zip/node_modules/react/index.js"
    1 │ import d from "../.yarn/cache/react-npm-17.0.1-98658812fc-a76d86ec97.zip/node_modules/react/index.js";export default d;
      ╵               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error when starting dev server:
Error: Build failed with 3 errors:
error: Cannot read directory "../.yarn/cache/react-npm-17.0.1-98658812fc-a76d86ec97.zip": not a directory
dep:react:1:14: error: Could not resolve "../.yarn/cache/react-npm-17.0.1-98658812fc-a76d86ec97.zip/node_modules/react/index.js"
dep:react-dom:1:14: error: Could not resolve "../.yarn/$$virtual/react-dom-virtual-b6e8a2f47c/0/cache/react-dom-npm-17.0.1-588d0088ca-6a70028fbe.zip/node_modules/react-dom/index.js"
    at failureErrorWithLog (/home/lege/Documents/projects/vite-app/.yarn/unplugged/esbuild-npm-0.8.36-2aef594cc9/node_modules/esbuild/lib/main.js:969:15)
    at buildResponseToResult (/home/lege/Documents/projects/vite-app/.yarn/unplugged/esbuild-npm-0.8.36-2aef594cc9/node_modules/esbuild/lib/main.js:767:32)
    at /home/lege/Documents/projects/vite-app/.yarn/unplugged/esbuild-npm-0.8.36-2aef594cc9/node_modules/esbuild/lib/main.js:819:20
    at handleIncomingPacket (/home/lege/Documents/projects/vite-app/.yarn/unplugged/esbuild-npm-0.8.36-2aef594cc9/node_modules/esbuild/lib/main.js:566:9)
    at Socket.readFromStdout (/home/lege/Documents/projects/vite-app/.yarn/unplugged/esbuild-npm-0.8.36-2aef594cc9/node_modules/esbuild/lib/main.js:482:7)
    at Socket.emit (events.js:209:13)
    at addChunk (_stream_readable.js:305:12)
    at readableAddChunk (_stream_readable.js:286:11)
    at Socket.Readable.push (_stream_readable.js:220:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)
@hlege
Copy link
Author

hlege commented Jan 31, 2021

It still doesnt work in beta.60,i think you made a mistake in esbuildDepPlugin.ts:150, but iam not sure. If i switch undefined and root it is working.
resolveDir: isRunningWithYarnPnp ? undefined : root -> resolveDir: isRunningWithYarnPnp ? root : undefined

@yyx990803
Copy link
Member

That change was actually not needed but I forgot to undo the change before committing... 9c6edef

@strrchr
Copy link

strrchr commented Apr 21, 2021

Must use local cache:
enableGlobalCache: false
if enableGlobalCache: true, it is still broken.

@Niputi
Copy link
Contributor

Niputi commented Apr 21, 2021

@strrchr you should make a new issue following the issue template with a reproduction

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants