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

Cannot run when yarn uses global cache as repository and the project and cache are in different drives #15801

Closed
7 tasks done
andre-rafa-b opened this issue Feb 4, 2024 · 6 comments
Labels
duplicate This issue or pull request already exists

Comments

@andre-rafa-b
Copy link

andre-rafa-b commented Feb 4, 2024

Describe the bug

I use yarn in plug n play mode where the modules are stored in a global cache like C:...AppData...Local\Yarn.
I just create a project which uses yarn + vite + react. The project is located at D:\Projects.
When I run yarn run dev I got an error "Could not read from file .... react-dom/client.js"

I tried to move the cache to C:.yarn-cache without luck but it worked when I moved to D:.yarn-cache.
I had other react projects working fine using webpack and it's my first time using Vite.

Reproduction

#15801 (comment)

Steps to reproduce

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
    Memory: 8.25 GB / 15.90 GB
  Binaries:
    Node: 20.9.0 - D:\Program Files\nodejs\node.EXE      
    Yarn: 4.1.0 - D:\Program Files\nodejs\yarn.CMD
    npm: 8.18.0 - D:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (121.0.2277.98)
    Internet Explorer: 11.0.19041.3636

Used Package Manager

yarn

Logs

Could not read from file: D:/Desenvolvimento/Estudos/React/vite/.yarn/virtual/react-dom-virtual-91a0a8ad3c/6/C:/Users/andre/AppData/Local/Yarn/Berry/cache/react-dom-npm-18.2.0-dd675bca1c-10c0.zip/node_modules/react-dom/client.js

Validations

Copy link

github-actions bot commented Feb 6, 2024

Hello @andre-rafa-b. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

mcenkar added a commit to mcenkar/vite-15801 that referenced this issue Feb 6, 2024
@mcenkar
Copy link

mcenkar commented Feb 6, 2024

Hi,

created reproduction here: mcenkar/vite-15801

Just simple starter project from https://vitejs.dev/guide/#scaffolding-your-first-vite-project

yarn config set enableGlobalCache false && yarn && yarn dev works just fine, but on default I get:

X [ERROR] Could not read from file: ...path.../.yarn/__virtual__/vue-virtual-42724c22b5/6/...path.../.yarn/Berry/cache/vue-npm-3.4.15-11fe9fcc84-10c0.zip/node_modules/vue/dist/vue.runtime.esm-bundler.js

Also in my case it doesn't need to be separate disk, I have project and cache on same disk and get mentioned error.

@sapphi-red
Copy link
Member

Currently Vite doesn't support cross-drive links.
Duplicate of #8908 #10802 #15496

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2024
@sapphi-red sapphi-red added the duplicate This issue or pull request already exists label Feb 8, 2024
@mcenkar
Copy link

mcenkar commented Feb 8, 2024

Currently Vite doesn't support cross-drive links. Duplicate of #8908 #10802 #15496

Hi @sapphi-red, it's not actually even cross-drive link, even same drive doesn't work. Basically for me there is no way to enable global cache and I had to completely disable it in global settings.

IMHO if there was workaround this could be ignored, but right now it totally breaks global cache, and only way is to use project-folder/.yarn/cache.

So I would appreciate if you could rethink if this is really won't fix. And judging by number of duplicates it affects a lot of users.

If this is really won't fix then perhaps warning for users is better, as right now they just see error, investigate, and file yet another duplicate.

@sapphi-red
Copy link
Member

@mcenkar Sorry I totally overlooked your comment. I've tried on my Windows machine and I wasn't able to reproduce. Would you create a new issue with more details? (e.g. OS, where the global cache is located)

@andre-rafa-b
Copy link
Author

@mcenkar in my case indeed the error was caused by cross drive link. I can't recommend vite for the rest of the team by now. I hope vite can support this kind of environment soon. Thanks for the replies

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants