nestjsvitest

Having EBUSY: resource busy or locked, rmdir 'blablabla...\dist' when trying to run Nest project locally via VSCode


I was facing this exact error every time I tried to run a Nest project locally via VSCode and I didn't find anything related to it on the internet, so I'm gonna post a question and the answer I found to my specific context.

Error  EBUSY: resource busy or locked, rmdir 'C:\code\Pessoal\Magic3t-Backend\dist'

Context:


Solution

  • The problem was that I forgot to exclude my vitest.config.ts from tsconfig.build.json, as shown below.
    enter image description here

    It made vitest.config.ts get compiled into a vitest.config.js inside the dist folder:
    enter image description here

    Which made the extension think it should consider that file and locked it for some reason (I don't know why, to be honest).
    Adding vitest.config.ts to exclude solved my problem.