Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: EBUSY: resource busy or locked, rmdir

The error occurs after following steps in windows:

  1. Open one terminal: npm run start:dev
  2. Open another terminal: ng build --watch

However, it works in Mac by using the above commands. Part of the package.json configuration are:

"scripts": { "ng": "ng", "start:dev:prod": "ng build --prod && cd dist/ && node static/server.js", "start": "node static/server.js", "build:prod": "ng build --prod", "test": "ng test --code-coverage", "lint": "ng lint", "e2e": "ng e2e", "start:dev": "npm run build & cd dist/ & SET APP_ENV=dev & node static/server.js", "build": "ng build" }, 

Error log:

Error: EBUSY: resource busy or locked, rmdir 'C:\AngularProject\dist' Error: EBUSY: resource busy or locked, rmdir 'C:\Spring-Intern-Projects\wdpr-accounting-reference-client\dist' at Object.rmdirSync (fs.js:701:3) 
like image 991
Xiaohua Cao Avatar asked Mar 17 '19 23:03

Xiaohua Cao


People also ask

What is Ebusy?

EBUSY: “Device or resource busy.” A system resource that can't be shared is already in use. For example, if you try to delete a file that is the root of a currently mounted filesystem, you get this error.


1 Answers

If all the above solutions did not work AND you are using windows PC like in my case, the easiest thing to do is:

  1. Press windows key plus R on your keyboard to open the run command box and type this

    resmon.exe

  2. click OK to open resource monitor

  3. In the monitor, navigate to CPU tab

  4. Under Associated Handles in the search box, copy the path to the file or folder in question and paste it in there

  5. Click on the search icon

  6. You should be able to see all the programs using the file or folder

  7. right-click each and end-process

enter image description here

Now, continue what you were trying to do on the file or folder. In my case I was having problems using react-create-app via npm. More information here #117908

I just hope it helps someone.

like image 52
Nicholas Mberev Avatar answered Sep 22 '22 10:09

Nicholas Mberev