vite: Unable to the run vue app with latest vite version 2.9.0 and above

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,

image

I tried all the below versions. I got the same above error,

image

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,

image

Reproduction

https://github.com/sadashivm/vue3-latest

System Info

OS - Windows 10,
Node - v16.14.2
npm - 8.7.2

Used Package Manager

npm

Logs

12:58:28 pm [vite] error while updating dependencies:
Error: EPERM: operation not permitted, rename 'D:/Vue/vue3-latest/node_modules/.vite/processing' -> 'D:/Vue/vue3-latest/node_modules/.vite/deps'
    at Object.renameSync (node:fs:980:3)
    at commitProcessingDepsCacheSync (D:\Vue\vue3-latest\node_modules\vite\dist\node\chunks\dep-8db0e223.js:37269:21)
    at Object.commit (D:\Vue\vue3-latest\node_modules\vite\dist\node\chunks\dep-8db0e223.js:37261:13)
    at commitProcessing (D:\Vue\vue3-latest\node_modules\vite\dist\node\chunks\dep-8db0e223.js:58587:34)
    at runOptimizer (D:\Vue\vue3-latest\node_modules\vite\dist\node\chunks\dep-8db0e223.js:58625:17)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Validations

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (20 by maintainers)

Commits related to this issue

Most upvoted comments

@patak-dev Oddly, my machine does not produce an error in the fs.rename callback (er is always null for me), even with antivirus enabled, so I cannot verify the change in #8036 (although that change appears correct to me).

It seems replacing fs.renameSync() with the promisify-ied fs.rename() was enough to resolve the problem on my machine.

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. I have a manual work around for now: If the error happens, manually delete node_modules/.vite/deps and manually rename node_modules/.vite/processing -> deps, restart vite. Luckily I don’t change dependencies that often.

Wow Great!. It is working perfectly. Thank you so much @patak-dev

Here is the updated package.json file,

image

I have uninstalled all the dev depency packages and installed the latest one.

It is working as well.

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 🥲

Not a fan of letting these antivirus software “win”, but I guess we could implement retries if it’s just for this case 😄