The error occurs after following steps in windows:
npm run start:dev
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)
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.
If all the above solutions did not work AND you are using windows PC like in my case, the easiest thing to do is:
Press windows key plus R on your keyboard to open the run command box and type this
resmon.exe
click OK to open resource monitor
In the monitor, navigate to CPU tab
Under Associated Handles in the search box, copy the path to the file or folder in question and paste it in there
Click on the search icon
You should be able to see all the programs using the file or folder
right-click each and end-process
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With