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
Unable to the run vue app with latest vite version 2.9.0 and above #7939
Comments
Vite 2.9 has a new prebundling method that does vite/packages/vite/src/node/optimizer/index.ts Lines 540 to 541 in 274c10e
We did ensure the |
Do you have an Antivirus enabled? I was checking this related node issue: nodejs/node#29481 (comment) If that is the case, we could add some retry scheme like graceful-fs is using here: https://github.com/isaacs/node-graceful-fs/blob/main/polyfills.js#L88-L116 @bluwy following the issues, it looks like remove dir sync could return before the directory is properly deleted (because of Antivirus or indexing software locking some files). Looks like they tried to bake a fix in libuv and then they reverted it. |
Not a fan of letting these antivirus software "win", but I guess we could implement retries if it's just for this case |
Yes I have antivirus active |
Team, |
Turn off your antivirus |
Sorry to say, this is not correct soultion right? |
I'm not the person for security advice so take my comment with a grain of salt, but I've never quite find antivirus software to be really helpful as long as you're browsing safely and only install software you trust. Plus modern browsers all have solid first line of defence to protect you from it. It's worked for me and I never had issues on my machines (windows/linux/mac). If you're on Windows, you can turn on Windows Defender and remove any other antivirus software. That has worked well even for my 8yo brother who randomly installs stuff |
I'm having the same issue. As an experiment I disabled the virus check for my project folder (and sub-folders) but that didn't seem to have an effect. When I run the vite dev server and check the Using vite@2.9.6 |
@mattnathan @sadashivm would you test vite@2.9.8 in your projects and report back? Thanks! |
Wow Great!. It is working perfectly. Here is the updated package.json file, I have uninstalled all the dev depency packages and installed the latest one. It is working as well. |
Unfortunately this didn't change anything for me, still getting the same error and
|
I've done some digging (mostly by adjusting the code in my node_modules/vite dir) - here are my findings: It appears that During the second run, the rename fails with Adding a sleep (2s, chosen at random) between the "delete deps dir" and "rename processing to deps" steps in With all that said I think I think that if there were a Thanks for looking into this issue, it's really appreciated. |
Hey @mattnathan, I don't know how much better we can do without making this more complex. I would suggest reviewing what kind of processes or antivirus you have in your system. At least without more data about how common this is, I think we may need to wait a bit here. If it is common enough, maybe we could first rename |
I don't think any of those options will work for me. I've disabled my antivirus completely (temporarily while running these tests), so it's not that, well I don't think it's that - I'm never sure :(. The value of I've done a little test adding a
The code looks basically like this:
This all makes me think that there's something strange going on. Why would Changing the code so it's the equivalent to the below, actually results in a different error which surprised me, as the deps dir appears to be empty to me.
No idea why the first |
@mattnathan I think you're right, we may be seeing a bug in the node-graceful-fs rename version we copied. Would you check if #8036 works in your system? |
Related vuejs/core#5823 |
I reproduced the error messages on
And verified that updating to Vite 2.9.8 resolved the issue. @mattnathan Maybe I'm missing something important. What antivirus are you using? |
Thanks for continuing to look at this, I really appreciate it. The change made in #8036 hasn't fixed the issue for me, though the change looks worthwhile and I now see a 5s delay before the error shows indicating the retry is executing. Something I've noticed while I've been trying to create a reproduction repository is that this error is triggered under very specific (but unknown) conditions. There seems to be some timing somewhere that causes this to happen that isn't covered by the retry logic. As an example, I have a component whose template looks like In all cases I'm using Vuetify and Vue2. I think this is important because the loading of Vuetify causes // vite.config.js
import {defineConfig} from 'vite';
import {createVuePlugin} from 'vite-plugin-vue2';
import rollupPluginVuetify from 'rollup-plugin-vuetify';
import {VuetifyResolver} from 'unplugin-vue-components/resolvers';
import Components from 'unplugin-vue-components/vite';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
createVuePlugin(),
Components({
resolvers: [
// Vuetify
VuetifyResolver(),
],
}),
rollupPluginVuetify(),
]
}) @tony19 I've attempted this with Windows Defender, Sentinal One (centrally managed), and with AV turned off completely without change in outcome. Unfortunately I have been unable to create a reliable reproduction of this issue that I'm happy to share, I have reproduced it in a fresh repo but it feels very flaky so I'm doubtful it would reproduce for all people/runs. |
Ok, we'll merge #8036 as that should help others with more intrusive Antivirus. But waiting a few seconds for a rename goes against DX, the whole idea of doing the deleteSync/renameSync was to avoid timing issues. We can leave this issue open for a bit @mattnathan, and see if others are experiencing the same. You could work on a PR to do things differently, but we should really take care of avoiding extra complexity if this actually ends up being an issue in your setup. One thing you could try (and only for win32) But the initial rename may also fail? Worth trying it though... and you could ask the other users in this issue to try your PR |
I totally agree, don't want to make life worse for most just for me. Thanks for your time on this so far. I'll have a go at writing a PR, but I won't be able to look into this until at least w/c 23rd unfortunately. |
@patak-dev Oddly, my machine does not produce an error in the It seems replacing |
Managed to get around to this a little earlier than expected. Vite with the applied PR now consistently works on my system in places where it used to fail. |
Describe the bug
Hello team,
I've created a latest vue project using below command,
npm init vue@latest
and project was created, in the latest code vite version installed as
"vite": "^2.9.5".
I tried all the versions from 2.9.0 to 2.9.6, but didn't worked. When run the below command,
npm run dev
I'm getting bellow error,
I tried all the below versions. I got the same above error,
But when I build the application it is working fine. like,
npm run build
Finally I downgraded the vite version to ("vite": "2.8.6"), the app is working properly like,
Reproduction
https://github.com/sadashivm/vue3-latest
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: