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
Resolver tries to access absolute paths and crashes #12523
Comments
Is your project inside |
No, my project is in my home directory, |
When it comes to performance: You don't necessarily have to check for permissions, but you should catch exceptions when trying to access a guessed path. |
That's the issue. Catching errors is expensive, more so the effort to generate the error by node, which we will discard anyways. So we're making the assumption that you can access all your files inside your project directory to speed things up for most user's setups. (To clarify, we only check for file existence, not file access permissions. The former is much cheaper to run)
I'd probably advise against this for similar reasons. Vite can handle it today, but you'll lose out on some fast-paths Vite has if you have your project in a deeper directory instead. Overall, we technically can fix this issue, but it'll lose out performance for many users that won't have this specific setup, and I think it isn't worth it. |
Please elaborate on that. The assumption that vite can access all files in the project directory is correct. The Problem is that vite searches outside the project directory (as I said, it tries to access About your advise: If not in your home directory (where you have write access to), where would you put projects? Or did you misunderstood my description maybe? The project directory is in a deeper directory in my home folder. |
Just to clarify and be specific:
|
I see, I thought you mean the Vite project being on the root Though I wonder how you're accessing that directory in the first place? Why do you access But with that said, that specific error will be fixed by #12542 (comment) soon |
It's just a normal route in my React app, like any other path can be. |
By the way, I just verified that the breaking change was between |
I think specifically this removal is responsible for this: |
That being said, I tested against FYI, a test which should always fail on POSIX systems, when not running in docker, would be to access |
Thanks for testing on |
Describe the bug
When trying to access a path in a vite project which corresponds to an absolute path on your local disk, but is unreadable by the current users, vite crashes with an
EACCESS
error.Ideally, Vite should not try to access absolute paths anywhere in the system. But at the least, it should catch
EACCESS
errors and know that it the tried path is invalid.Reproduction
N/A
Steps to reproduce
/recovery
which is only readable by theroot
usernpm create vite@latest test
andnpm run dev
ithttp://localhost:<port>/recovery
pathSystem Info
System: OS: Linux 6.2 Pop!_OS 22.04 LTS CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900K Memory: 46.10 GB / 62.54 GB Container: Yes Shell: 5.1.16 - /bin/bash Binaries: Node: 18.15.0 - /usr/bin/node Yarn: 1.22.17 - /usr/bin/yarn npm: 9.5.0 - /usr/bin/npm Browsers: Chrome: 110.0.5481.96 Firefox: 111.0
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: