0

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?

3
  • 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. Commented Oct 14, 2020 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. Commented Oct 15, 2020 at 0:16
  • Check this thread: [[WSL] Unable to launch /usr/bin/gdb when setting bash.exe as the integrated shell in VS Code](github.com/microsoft/vscode-cpptools/issues/2811) Especially the json part may resolve your issue I suppose.
    – Sysadmin
    Commented Oct 15, 2020 at 8:23

2 Answers 2

2

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

2
  • I ran an npm install lsof and it was successful but bash is still complaining no command found.
    – Daniel
    Commented Oct 14, 2020 at 20:08
  • please provide the output of whereis lsof Commented Oct 14, 2020 at 20:24
0

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.

5
  • I added additional info to the question.
    – Daniel
    Commented Oct 14, 2020 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
    Commented Oct 14, 2020 at 19:06
  • thank you for your help.
    – Daniel
    Commented Oct 14, 2020 at 20:12
  • you certainly only run one of these two lines, right? they do the same; dnf is the modern "drop-in replacement" for yum. Commented Jun 24, 2021 at 15:31
  • Yes Marcus Müller, you are right. On Debian family we use apt or apt-get.
    – Sysadmin
    Commented Jan 20, 2022 at 21:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .