I am trying to start up my application with npm start, however I get the following errors:

rm: cannot remove 'dist/': Device or resource busy

When I try to run an lsof I get the error message: bash: lsof: command not found. I noticed that there is no /usr/sbin/ inside there, but only /usr/share and /usr/ssl/.

I am using this Visual Studio Code bash terminal from within a Windows 10 environment.

How can I resolve this?

  • Can you add the output of lsb_release -a to your question? That will help us determine the correct command to use to install lsof. – Mark Plotnick Oct 14 at 21:35
  • Does the dist directory lie under one of the windows filesystems such as /mnt/c or /mnt/d? A frequent cause of "device busy" errors in WSL is when the directory or file is in use by a native Windows program. – Mark Plotnick Oct 15 at 0:16

Normally in CentOS/Fedora/RHEL I install it this way:

yum install lsof
dnf install lsof

Then I can use it. So first try to install it.

| improve this answer | |
  • I added additional info to the question. – Daniel Oct 14 at 19:00
  • 1
    I do not use the Windows this way. I am Linux sysadmin. I have no idea. is it a WSL? If yes, then read this: code.visualstudio.com/docs/cpp/config-wsl – Sysadmin Oct 14 at 19:06
  • thank you for your help. – Daniel Oct 14 at 20:12

If I understand your question I believe you are using WSL on Windows 10, to install lsof you need to run the following command npm install lsof since you have npm installed on your machine, or use the traditional way to install it sudo apt install lsof from Ubuntu\Debian terminal. regarding the other part, once you install lsof you can use lsof -D /mypath then kill the process that use any file in that directory.

Note: if you are using suse then you can use the following commands

 sudo zypper ref
 sudo zypper up
 sudo zypper install lsof

edit the command above also work in stand alone Ubuntu\Debian or Suse

| improve this answer | |
  • I ran an npm install lsof and it was successful but bash is still complaining no command found. – Daniel Oct 14 at 20:08
  • please provide the output of whereis lsof – Ahmad Abuhasna Oct 14 at 20:24

Check this thread: [WSL] Unable to launch /usr/bin/gdb when setting bash.exe as the integrated shell in VS Code Especially the json part may resolve your issue I suppose.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.