node.jspython-3.xnpmwebrtcmediasoup

Mediasoup installation failed on windows


I am trying to install mediasoup version 3, and here is the error that occurs during the installation:

$ npm i mediasoup --save
some dependencies like ninja and meson are installed successful.
/f/allMy/Projects/Practice/WebRTC/Mediasoup/node_modules/mediasoup/worker/out/pip/bin/meson setup \    
npm ERR!                --prefix /f/allMy/Projects/Practice/WebRTC/Mediasoup/node_modules/mediasoup/worker/out/Release \
npm ERR!                --bindir '' \
npm ERR!                --libdir '' \
npm ERR!                --buildtype release \
npm ERR!                -Db_ndebug=true \
npm ERR!                -Db_pie=true \
npm ERR!                -Db_staticpic=true \
npm ERR!                --reconfigure \
npm ERR!                --vsenv \
npm ERR!                /f/allMy/Projects/Practice/WebRTC/Mediasoup/node_modules/mediasoup/worker/out/Release/build || \
npm ERR!                /f/allMy/Projects/Practice/WebRTC/Mediasoup/node_modules/mediasoup/worker/out/pip/bin/meson setup \
npm ERR!                        --prefix /f/allMy/Projects/Practice/WebRTC/Mediasoup/node_modules/mediasoup/worker/out/Release \
npm ERR!                        --bindir '' \
npm ERR!                        --libdir '' \
npm ERR!                        --buildtype release \
npm ERR!                        -Db_ndebug=true \
npm ERR!                        -Db_pie=true \
npm ERR!                        -Db_staticpic=true \
npm ERR!                        --vsenv \
npm ERR!                        /f/allMy/Projects/Practice/WebRTC/Mediasoup/node_modules/mediasoup/worker/out/Release/build
npm ERR! The Meson build system
npm ERR! Version: 0.61.5
npm ERR! Source dir: F:\allMy\Projects\Practice\WebRTC\Mediasoup\node_modules\mediasoup\worker
npm ERR! Build dir: F:\allMy\Projects\Practice\WebRTC\Mediasoup\node_modules\mediasoup\worker\out\Release\build
npm ERR! Build type: native build
npm ERR! Project name: mediasoup-worker
npm ERR! Project version: undefined
npm ERR!
npm ERR! meson.build:1:0: ERROR: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
npm ERR!
npm ERR! A full log can be found at F:\allMy\Projects\Practice\WebRTC\Mediasoup\node_modules\mediasoup\worker\out\Release\build\meson-logs\meson-log.txt
npm ERR! make: Leaving directory `/f/allMy/Projects/Practice/WebRTC/Mediasoup/node_modules/mediasoup/worker'    
npm ERR! Usage:   
npm ERR!   c:\Users\tonys\AppData\Local\Programs\Python\Python311\python3.exe -m pip install [options] <requirement specifier> [package-index-options] ...
npm ERR!   c:\Users\tonys\AppData\Local\Programs\Python\Python311\python3.exe -m pip install [options] -r <requirements file> [package-index-options] ...
npm ERR!   c:\Users\tonys\AppData\Local\Programs\Python\Python311\python3.exe -m pip install [options] [-e] <vcs project url> ...
npm ERR!   c:\Users\tonys\AppData\Local\Programs\Python\Python311\python3.exe -m pip install [options] [-e] <local project path> ...
npm ERR!   c:\Users\tonys\AppData\Local\Programs\Python\Python311\python3.exe -m pip install [options] <archive 
url/path> ...
npm ERR!
npm ERR! no such option: --system
npm ERR! Directory does not contain a valid build tree:
npm ERR! F:\allMy\Projects\Practice\WebRTC\Mediasoup\node_modules\mediasoup\worker\out\Release\build
npm ERR! make: *** [setup] Error 1
npm ERR! npm-scripts.js [ERROR] executeCmd() failed, exiting: Error: Command failed: make -C worker

My versions:

Python:3.11

VSCode:1.77.3

Node Js:16.13.1

I have already tried installing via Yarn, but that did not solve it.


Solution

  • As we (I and the OP) discussed in the comments, this is the answer according to what worked for both of us on Windows. The problem was that Microsoft Visual Studio C++ wasn't installed, or not installed correctly. A required feature of mediasoup is msbuild, and maybe some other unidentified ones that are included in Microsoft Visual Studio C++.

    Steps to fix this issue:

    1. Download Visual Studio from https://visualstudio.microsoft.com/downloads/
    2. Install, and make sure you have the C++ development options checked, if you further look into what it installs, you can see msbuild, and proceed with the installation including it, and the other essential tools it has checked by default for you.
    3. After that, restart your computer.
    4. Then go to your project folder again and retry the npm install mediasoup@3 command, it should work now.

    Note: This answer is for Windows only, I tried the npm install mediasoup@3 command on my Debian machine that has make installed and it worked without requiring me to do any of the aforementioned steps. The same thing was noticed by the OP, that they tried this on Linux and it simply worked without any of this jargon.