Try npm install mediasoup on windows 10, but failed

I want to install the mediasoup but after the “npm install mediasoup” command I get this error:

98 info run mediasoup@3.9.1 postinstall node_modules/mediasoup node npm-scripts.js postinstall
99 info run mediasoup@3.9.1 postinstall { code: 1, signal: null }

How can I fix?

Thank you

0 verbose cli [
0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'install',
0 verbose cli   'mediasoup'
0 verbose cli ]
1 info using npm@8.0.0
2 info using node@v16.11.1
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:H:\workspace\test\.npmrc Completed in 1ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:C:\Users\17113\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Users\17113\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 10ms
19 timing npm:load:configload Completed in 10ms
20 timing npm:load:setTitle Completed in 1ms
21 timing npm:load:setupLog Completed in 0ms
22 timing config:load:flatten Completed in 3ms
23 timing npm:load:cleanupLog Completed in 2ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 1ms
26 timing npm:load Completed in 18ms
27 timing arborist:ctor Completed in 0ms
28 timing arborist:ctor Completed in 0ms
29 timing idealTree:init Completed in 11ms
30 timing idealTree:userRequests Completed in 2ms
31 silly idealTree buildDeps
32 silly fetch manifest mediasoup@*
33 http fetch GET 200 https://registry.npmjs.org/mediasoup 1401ms (cache revalidated)
34 silly placeDep ROOT mediasoup@3.9.1 OK for: test@1.0.0 want: *
35 silly fetch manifest @types/node@^16.11.6
36 silly fetch manifest awaitqueue@^2.3.3
37 silly fetch manifest debug@^4.3.2
38 silly fetch manifest h264-profile-level-id@^1.0.1
39 silly fetch manifest random-number@^0.0.9
40 silly fetch manifest supports-color@^9.0.2
41 silly fetch manifest uuid@^8.3.2
42 http fetch GET 200 https://registry.npmjs.org/debug 336ms (cache revalidated)
43 http fetch GET 200 https://registry.npmjs.org/uuid 956ms (cache revalidated)
44 http fetch GET 200 https://registry.npmjs.org/awaitqueue 1082ms (cache revalidated)
45 http fetch GET 200 https://registry.npmjs.org/h264-profile-level-id 1084ms (cache revalidated)
46 http fetch GET 200 https://registry.npmjs.org/random-number 1085ms (cache revalidated)
47 http fetch GET 200 https://registry.npmjs.org/supports-color 1750ms (cache revalidated)
48 http fetch GET 200 https://registry.npmjs.org/@types%2fnode 1779ms (cache revalidated)
49 timing idealTree:#root Completed in 3200ms
50 silly placeDep ROOT @types/node@16.11.6 OK for: mediasoup@3.9.1 want: ^16.11.6
51 silly placeDep ROOT awaitqueue@2.3.3 OK for: mediasoup@3.9.1 want: ^2.3.3
52 silly placeDep ROOT debug@4.3.2 OK for: mediasoup@3.9.1 want: ^4.3.2
53 silly placeDep ROOT h264-profile-level-id@1.0.1 OK for: mediasoup@3.9.1 want: ^1.0.1
54 silly placeDep ROOT random-number@0.0.9 OK for: mediasoup@3.9.1 want: ^0.0.9
55 silly placeDep ROOT supports-color@9.0.2 OK for: mediasoup@3.9.1 want: ^9.0.2
56 silly placeDep ROOT uuid@8.3.2 OK for: mediasoup@3.9.1 want: ^8.3.2
57 silly fetch manifest ms@2.1.2
58 silly fetch manifest has-flag@^5.0.0
59 http fetch GET 200 https://registry.npmjs.org/ms 1214ms (cache revalidated)
60 http fetch GET 200 https://registry.npmjs.org/has-flag 1221ms (cache revalidated)
61 timing idealTree:node_modules/mediasoup Completed in 1241ms
62 timing idealTree:node_modules/@types/node Completed in 0ms
63 timing idealTree:node_modules/awaitqueue Completed in 0ms
64 silly placeDep ROOT ms@2.1.2 OK for: debug@4.3.2 want: 2.1.2
65 timing idealTree:node_modules/debug Completed in 1ms
66 timing idealTree:node_modules/h264-profile-level-id Completed in 0ms
67 timing idealTree:node_modules/ms Completed in 0ms
68 timing idealTree:node_modules/random-number Completed in 0ms
69 silly placeDep ROOT has-flag@5.0.1 OK for: supports-color@9.0.2 want: ^5.0.0
70 timing idealTree:node_modules/supports-color Completed in 2ms
71 timing idealTree:node_modules/has-flag Completed in 0ms
72 timing idealTree:node_modules/uuid Completed in 0ms
73 timing idealTree:buildDeps Completed in 4445ms
74 timing idealTree:fixDepFlags Completed in 0ms
75 timing idealTree Completed in 4459ms
76 timing reify:loadTrees Completed in 4460ms
77 timing reify:diffTrees Completed in 1ms
78 silly reify moves {}
79 timing reify:retireShallow Completed in 0ms
80 timing reify:createSparse Completed in 6ms
81 timing reify:loadBundles Completed in 0ms
82 silly audit bulk request {
82 silly audit   mediasoup: [ '3.9.1' ],
82 silly audit   '@types/node': [ '16.11.6' ],
82 silly audit   awaitqueue: [ '2.3.3' ],
82 silly audit   debug: [ '4.3.2' ],
82 silly audit   'h264-profile-level-id': [ '1.0.1' ],
82 silly audit   'random-number': [ '0.0.9' ],
82 silly audit   'supports-color': [ '9.0.2' ],
82 silly audit   uuid: [ '8.3.2' ],
82 silly audit   ms: [ '2.1.2' ],
82 silly audit   'has-flag': [ '5.0.1' ]
82 silly audit }
83 timing reifyNode:node_modules/ms Completed in 80ms
84 timing reifyNode:node_modules/has-flag Completed in 83ms
85 timing reifyNode:node_modules/supports-color Completed in 82ms
86 timing reifyNode:node_modules/random-number Completed in 90ms
87 timing reifyNode:node_modules/h264-profile-level-id Completed in 90ms
88 timing reifyNode:node_modules/debug Completed in 91ms
89 timing reifyNode:node_modules/awaitqueue Completed in 92ms
90 timing reifyNode:node_modules/uuid Completed in 159ms
91 timing reifyNode:node_modules/@types/node Completed in 189ms
92 timing reifyNode:node_modules/mediasoup Completed in 667ms
93 timing reify:unpack Completed in 668ms
94 timing reify:unretire Completed in 0ms
95 timing build:queue Completed in 2ms
96 timing build:link:node_modules/uuid Completed in 5ms
97 timing build:link Completed in 5ms
98 info run mediasoup@3.9.1 postinstall node_modules/mediasoup node npm-scripts.js postinstall
99 info run mediasoup@3.9.1 postinstall { code: 1, signal: null }
100 timing reify:rollback:createSparse Completed in 111ms
101 timing reify:rollback:retireShallow Completed in 0ms
102 timing command:install Completed in 5671ms
103 verbose stack Error: command failed
103 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
103 verbose stack     at ChildProcess.emit (node:events:390:28)
103 verbose stack     at maybeClose (node:internal/child_process:1064:16)
103 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
104 verbose pkgid mediasoup@3.9.1
105 verbose cwd H:\workspace\test
106 verbose Windows_NT 10.0.19042
107 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "mediasoup"
108 verbose node v16.11.1
109 verbose npm  v8.0.0
110 error code 1
111 error path H:\workspace\test\node_modules\mediasoup
112 error command failed
113 error command C:\WINDOWS\system32\cmd.exe /d /s /c node npm-scripts.js postinstall
114 error npm-scripts.js [INFO] running task "postinstall"
114 error npm-scripts.js [INFO] executing command: node npm-scripts.js worker:build
114 error npm-scripts.js [INFO] running task "worker:build"
114 error npm-scripts.js [INFO] executing command: make -C worker
115 verbose exit 1

Did you follow all of the latest Windows installation instructions?: mediasoup :: Installation
I don’t see what is wrong in your snippet, it just failed for no apparent reason it seems.

Yes, I did. I think it supposed to success, but failed . Maybe I did some wrong Installation ?
I don’t know every command to check out my Installation .
Like this:

gcc --version
PS H:\workspace\test> gcc --version
gcc.exe (MinGW.org GCC-6.3.0-1) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

or:

vcvars64
PS H:\workspace\test> vcvars64
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.5
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
PS H:\workspace\test>

would you tell me?
Thanks!

GCC is irrelevant here, you are supposed to use MSVC. What is the make that is available there? It must be GNU Make from MSYS.

C:\MinGW\msys\1.0\bin\make.exe

PS H:\workspace\test> python --version
Python 3.10.0
PS H:\workspace\test> pip --version
pip 21.2.3 from C:\Users\17113\AppData\Local\Programs\Python\Python310\lib\site-packages\pip (python 3.10)
PS H:\workspace\test> node -v
v16.11.1
PS H:\workspace\test> npm -v
8.0.0
PS H:\workspace\test> 

It seem to be right.
Did I missed something?

As I already said, it is important to make sure correct make version is used, while you provided all information except make version.

Sorry,I have provided the path:

C:\MinGW\msys\1.0\bin\make.exe

I just don’t konw how to get the make version…

PS H:\workspace> make --version
PS H:\workspace> make -v
PS H:\workspace> make --help
PS H:\workspace>

What command shuld I use?
Is this can provide something userful:

make -v should provide you an output saying it is GNU Make from MSYS. If it doesn’t, you likely didn’t follow all instructions and didn’t add C:\MinGW\msys\1.0\bin\ to Path.

I did…

I run the command make -v using Command Prompt get this:


It means:

Code execution cannot continue because msys-1.0.dll cannot be found. A new installation may solve the problem

This could be the reason why I failed.

After I tried reinstall again many times…

C:\MinGW\msys\1.0\bin>make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i686-pc-msys

C:\MinGW\msys\1.0\bin>

Then I get another error:

make: Entering directory `/h/workspace/test/node_modules/mediasoup/worker'
# Updated pip and setuptools are needed for meson
# `--system` is not present everywhere and is only needed as workaround for Debian-specific issue (copied from
# https://github.com/gluster/gstatus/pull/33), fallback to command without `--system` if the first one fails.
/c/Users/17113/AppData/Local/Microsoft/WindowsApps/python3 -m pip install --system --target=/h/workspace/test/node_modules/mediasoup/worker/out/pip 
pip setuptools || \
                /c/Users/17113/AppData/Local/Microsoft/WindowsApps/python3 -m pip install --target=/h/workspace/test/node_modules/mediasoup/worker/out/pip pip setuptools || \
                echo "Installation failed, likely because PIP is unavailable, if you are on Debian/Ubuntu or derivative please install the python3-pip package"
 - Cannot open - Cannot openInstallation failed, likely because PIP is unavailable, if you are on Debian/Ubuntu or derivative please install the python3-pip package
# Install `meson` and `ninja` using `pip` into custom location, so we don't depend on system-wide installation.
 meson ninja
 - Cannot openmake: *** [meson-ninja] Error 1
npm WARN test@1.0.0 No description
npm WARN test@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mediasoup@3.9.0 postinstall: `node npm-scripts.js postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mediasoup@3.9.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Feel so sad:

PS H:\workspace\test> pip --version
pip 21.2.3 from C:\Users\17113\AppData\Local\Programs\Python\Python310\lib\site-packages\pip (python 3.10)
PS H:\workspace\test>

The latest version of Python I installed is on C:\Users\17113\AppData\Local\Programs\Python\Python310,
but error from /c/Users/17113/AppData/Local/Microsoft/WindowsApps/python3.
I delete ‘/c/Users/17113/AppData/Local/Microsoft/WindowsApps’ from environment :

PS H:\workspace\test> npm i mediasoup

> mediasoup@3.9.0 postinstall H:\workspace\test\node_modules\mediasoup
> node npm-scripts.js postinstall

npm-scripts.js [INFO] running task "postinstall"
npm-scripts.js [INFO] executing command: node npm-scripts.js worker:build
npm-scripts.js [INFO] running task "worker:build"
npm-scripts.js [INFO] executing command: make -C worker
make: Entering directory `/h/workspace/test/node_modules/mediasoup/worker'
# Updated pip and setuptools are needed for meson
# `--system` is not present everywhere and is only needed as workaround for Debian-specific issue (copied 
from
# https://github.com/gluster/gstatus/pull/33), fallback to command without `--system` if the first one fails.
python -m pip install --system --target=/h/workspace/test/node_modules/mediasoup/worker/out/pip pip setuptools || \
                python -m pip install --target=/h/workspace/test/node_modules/mediasoup/worker/out/pip pip setuptools || \
                echo "Installation failed, likely because PIP is unavailable, if you are on Debian/Ubuntu 
or derivative please install the python3-pip package"

Usage:
  c:\Users\17113\AppData\Local\Programs\Python\Python310\python.exe -m pip install [options] <requirement 
specifier> [package-index-options] ...
  c:\Users\17113\AppData\Local\Programs\Python\Python310\python.exe -m pip install [options] -r <requirements file> [package-index-options] ...
  c:\Users\17113\AppData\Local\Programs\Python\Python310\python.exe -m pip install [options] [-e] <vcs project url> ...
  c:\Users\17113\AppData\Local\Programs\Python\Python310\python.exe -m pip install [options] [-e] <local project path> ...
  c:\Users\17113\AppData\Local\Programs\Python\Python310\python.exe -m pip install [options] <archive url/path> ...

no such option: --system
Collecting pip
  Using cached pip-21.3.1-py3-none-any.whl (1.7 MB)
Collecting setuptools
  Using cached setuptools-58.3.0-py3-none-any.whl (946 kB)
Installing collected packages: setuptools, pip
Successfully installed pip-21.3.1 setuptools-58.3.0
# Install `meson` and `ninja` using `pip` into custom location, so we don't depend on system-wide installation.
python -m pip install --upgrade --target=/h/workspace/test/node_modules/mediasoup/worker/out/pip meson ninja
Collecting meson
  Using cached meson-0.60.0-py3-none-any.whl (837 kB)
Collecting ninja
  Using cached ninja-1.10.2.2-py2.py3-none-win_amd64.whl (759 kB)
Installing collected packages: ninja, meson
Successfully installed meson-0.60.0 ninja-1.10.2.2
/h/workspace/test/node_modules/mediasoup/worker/out/pip/bin/meson setup \
                --buildtype release \
                -Db_ndebug=true \
                -Db_pie=true \
                -Db_staticpic=true \
                --reconfigure \
                "" \
                /h/workspace/test/node_modules/mediasoup/worker/out/Release || \
                /h/workspace/test/node_modules/mediasoup/worker/out/pip/bin/meson setup \
                        --buildtype release \
                        -Db_ndebug=true \
                        -Db_pie=true \
                        -Db_staticpic=true \
                        "" \
                        /h/workspace/test/node_modules/mediasoup/worker/out/Release
Directory does not contain a valid build tree:
H:\workspace\test\node_modules\mediasoup\worker\out\Release
The Meson build system
Version: 0.60.0
Source dir: H:\workspace\test\node_modules\mediasoup\worker
Build dir: H:\workspace\test\node_modules\mediasoup\worker\out\Release
Build type: native build
Project name: mediasoup-worker
Project version: undefined

meson.build:1:0: ERROR: Unknown compiler(s): [['cl']]
The following exception(s) were encountered:
Running "cl /?" gave "[WinError 2] 系统找不到指定的文件。"

A full log can be found at H:\workspace\test\node_modules\mediasoup\worker\out\Release\meson-logs\meson-log.txt
make: *** [setup] Error 1
make: Leaving directory `/h/workspace/test/node_modules/mediasoup/worker'
npm WARN test@1.0.0 No description
npm WARN test@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mediasoup@3.9.0 postinstall: `node npm-scripts.js postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mediasoup@3.9.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.        

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\17113\AppData\Roaming\npm-cache\_logs\2021-10-30T17_13_16_600Z-debug.log
PS H:\workspace\test> 

check the environment find :
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx64\x64
In fact, I have updated visual studio a few hours ago(try to fix something?) :
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64

I thought I should succeed this time:

PS H:\workspace\test> npm i mediasoup

> mediasoup@3.9.0 postinstall H:\workspace\test\node_modules\mediasoup
> node npm-scripts.js postinstall

npm-scripts.js [INFO] running task "postinstall"
npm-scripts.js [INFO] executing command: node npm-scripts.js worker:build
npm-scripts.js [INFO] running task "worker:build"
npm-scripts.js [INFO] executing command: make -C worker
make: Entering directory `/h/workspace/test/node_modules/mediasoup/worker'
# Updated pip and setuptools are needed for meson
# `--system` is not present everywhere and is only needed as workaround for Debian-specific issue (copied 
from
# https://github.com/gluster/gstatus/pull/33), fallback to command without `--system` if the first one fails.
python -m pip install --system --target=/h/workspace/test/node_modules/mediasoup/worker/out/pip pip setuptools || \
                python -m pip install --target=/h/workspace/test/node_modules/mediasoup/worker/out/pip pip setuptools || \
                echo "Installation failed, likely because PIP is unavailable, if you are on Debian/Ubuntu 
or derivative please install the python3-pip package"

Usage:
  c:\Users\17113\AppData\Local\Programs\Python\Python310\python.exe -m pip install [options] <requirement 
specifier> [package-index-options] ...
  c:\Users\17113\AppData\Local\Programs\Python\Python310\python.exe -m pip install [options] -r <requirements file> [package-index-options] ...
  c:\Users\17113\AppData\Local\Programs\Python\Python310\python.exe -m pip install [options] [-e] <vcs project url> ...
  c:\Users\17113\AppData\Local\Programs\Python\Python310\python.exe -m pip install [options] [-e] <local project path> ...
  c:\Users\17113\AppData\Local\Programs\Python\Python310\python.exe -m pip install [options] <archive url/path> ...

no such option: --system
Collecting pip
  Using cached pip-21.3.1-py3-none-any.whl (1.7 MB)
Collecting setuptools
  Using cached setuptools-58.3.0-py3-none-any.whl (946 kB)
Installing collected packages: setuptools, pip
Successfully installed pip-21.3.1 setuptools-58.3.0
# Install `meson` and `ninja` using `pip` into custom location, so we don't depend on system-wide installation.
python -m pip install --upgrade --target=/h/workspace/test/node_modules/mediasoup/worker/out/pip meson ninja
Collecting meson
  Using cached meson-0.60.0-py3-none-any.whl (837 kB)
Collecting ninja
  Using cached ninja-1.10.2.2-py2.py3-none-win_amd64.whl (759 kB)
Installing collected packages: ninja, meson
Successfully installed meson-0.60.0 ninja-1.10.2.2
/h/workspace/test/node_modules/mediasoup/worker/out/pip/bin/meson setup \
                --buildtype release \
                -Db_ndebug=true \
                -Db_pie=true \
                -Db_staticpic=true \
                --reconfigure \
                "" \
                /h/workspace/test/node_modules/mediasoup/worker/out/Release || \
                /h/workspace/test/node_modules/mediasoup/worker/out/pip/bin/meson setup \
                        --buildtype release \
                        -Db_ndebug=true \
                        -Db_pie=true \
                        -Db_staticpic=true \
                        "" \
                        /h/workspace/test/node_modules/mediasoup/worker/out/Release
Directory does not contain a valid build tree:
H:\workspace\test\node_modules\mediasoup\worker\out\Release
The Meson build system
Version: 0.60.0
Source dir: H:\workspace\test\node_modules\mediasoup\worker
Build dir: H:\workspace\test\node_modules\mediasoup\worker\out\Release
Build type: native build
Project name: mediasoup-worker
Project version: undefined

meson.build:1:0: ERROR: Compiler cl can not compile programs.

A full log can be found at H:\workspace\test\node_modules\mediasoup\worker\out\Release\meson-logs\meson-log.txt
make: *** [setup] Error 1
make: Leaving directory `/h/workspace/test/node_modules/mediasoup/worker'
npm WARN test@1.0.0 No description
npm WARN test@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mediasoup@3.9.0 postinstall: `node npm-scripts.js postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mediasoup@3.9.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.        

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\17113\AppData\Roaming\npm-cache\_logs\2021-10-30T17_21_55_775Z-debug.log

God: Just a little bug, you can solve it!
Me: I trust you.

There is also a note in the instructions about Python errors too. Just read and follow everything top to bottom without skipping and without diverting from instructions or you are on your own.

Thanks a lot ! Feel at ease with your help.
I will try install Microsoft Visual Studio 2017 to handle the ERROR: Compiler cl can not compile programs.
At least the problem is obvious。
Thank you again!