server npm install error

vagrant@ubuntu2004:~/code/mediasoup/server$ npm install
npm WARN deprecated source-map-url@0.4.1: See
npm WARN deprecated urix@0.1.0: Please see
npm WARN deprecated resolve-url@0.2.1:
npm WARN deprecated source-map-resolve@0.5.3: See
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm ERR! code 1
npm ERR! path /home/vagrant/code/mediasoup/server/node_modules/mediasoup
npm ERR! command failed
npm ERR! command sh -c -- node npm-scripts.mjs postinstall
npm ERR! npm-scripts [INFO] [postinstall] skipping mediasoup-worker prebuilt download, building it locally
npm ERR! npm-scripts [INFO] [postinstall] buildWorker()
npm ERR! npm-scripts [INFO] [postinstall] executeCmd(): make -C worker
npm ERR! make: Entering directory '/home/vagrant/code/mediasoup/server/node_modules/mediasoup/worker'
npm ERR! # Updated pip and setuptools are needed for meson.
npm ERR! # `--system` is not present everywhere and is only needed as workaround for
npm ERR! # Debian-specific issue (copied from,
npm ERR! # fallback to command without `--system` if the first one fails.
npm ERR! /usr/bin/python3 -m pip install --system --target=/home/vagrant/code/mediasoup/server/node_modules/mediasoup/worker/out/pip pip setuptools || \
npm ERR!        /usr/bin/python3 -m pip install --target=/home/vagrant/code/mediasoup/server/node_modules/mediasoup/worker/out/pip pip setuptools || \
npm ERR!        echo "Installation failed, likely because PIP is unavailable, if you are on Debian/Ubuntu or derivative please install the python3-pip package"
npm ERR! Looking in indexes:
npm ERR! Collecting pip
npm ERR!   Downloading (2.1 MB)
npm ERR! Collecting setuptools
npm ERR!   Downloading (807 kB)
npm ERR! Installing collected packages: pip, setuptools
npm ERR! Successfully installed pip-23.3.1 setuptools-68.2.2
npm ERR! # Install `meson` and `ninja` using `pip` into custom location, so we don't
npm ERR! # depend on system-wide installation.
npm ERR! /usr/bin/python3 -m pip install --upgrade --target=/home/vagrant/code/mediasoup/server/node_modules/mediasoup/worker/out/pip  meson==1.2.1 ninja==
npm ERR! Looking in indexes:
npm ERR! Collecting meson==1.2.1
npm ERR!   Using cached (962 kB)
npm ERR! Collecting ninja==
npm ERR!   Using cached (120 kB)
npm ERR! Installing collected packages: ninja, meson
npm ERR! Successfully installed meson-1.2.1 ninja-
npm ERR! make: Leaving directory '/home/vagrant/code/mediasoup/server/node_modules/mediasoup/worker'
npm ERR! ERROR: Exception:
npm ERR! Traceback (most recent call last):
npm ERR!   File "/home/vagrant/code/mediasoup/server/node_modules/mediasoup/worker/out/pip/pip/_internal/cli/", line 180, in exc_logging_wrapper
npm ERR!     status = run_func(*args)
npm ERR!   File "/home/vagrant/code/mediasoup/server/node_modules/mediasoup/worker/out/pip/pip/_internal/cli/", line 245, in wrapper
npm ERR!     return func(self, options, args)
npm ERR!   File "/home/vagrant/code/mediasoup/server/node_modules/mediasoup/worker/out/pip/pip/_internal/commands/", line 510, in run
npm ERR!     self._handle_target_dir(
npm ERR!   File "/home/vagrant/code/mediasoup/server/node_modules/mediasoup/worker/out/pip/pip/_internal/commands/", line 565, in _handle_target_dir
npm ERR!     shutil.rmtree(target_item_dir)
npm ERR!   File "/usr/lib/python3.8/", line 722, in rmtree
npm ERR!     onerror(os.rmdir, path, sys.exc_info())
npm ERR!   File "/usr/lib/python3.8/", line 720, in rmtree
npm ERR!     os.rmdir(path)
npm ERR! OSError: [Errno 26] Text file busy: '/home/vagrant/code/mediasoup/server/node_modules/mediasoup/worker/out/pip/bin'
npm ERR! make: *** [Makefile:102: meson-ninja] Error 2
npm ERR! npm-scripts [ERROR] [postinstall] executeCmd() failed, exiting: Error: Command failed: make -C worker

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2023-10-26T01_41_02_932Z-debug-0.log

The problem has been solved, I replaced the system with Debian11, the installation was successful twice, the ubuntu system has environmental problems, the same command, produced different results.

sudo su

curl -sL | bash -

sudo apt-get update

sudo apt-get install -y net-tools nodejs build-essential python3 python3-pip valgrind

npm install