前言
由于windows上下载mediasoup总是会报奇奇怪怪的错误,故做此文记录
下载mediasoup
npm i mediasoup --ignore-scripts
编译
- 需要提前下载visual studio 2019
- python3
cd node_modules/mediasoup
python ./worker/scripts/configure.py --format=msvs -R mediasoup-worker
如果出错
workerdepsgyppylibgypinput.py:1186: SyntaxWarning: "is" with a literal. Did you mean "=="?
if the_dict_key is 'variables' and variable_name in the_dict:
['--format=msvs', '-R', 'mediasoup-worker', 'worker\mediasoup-worker.gyp', '-I', 'worker\common.gypi', '--depth=worker', '-Dhost_arch=x64', '-Dtarget_arch=x64', '-Dopenssl_fips=', '-Dmediasoup_asan=false', '-Dnode_byteorder=little']
Traceback (most recent call last):
File "./worker/scripts/configure.py", line 114, in <module>
run_gyp(gyp_args)
File "./worker/scripts/configure.py", line 52, in run_gyp
rc = gyp.main(args)
File "workerdepsgyppylibgyp\__init__.py", line 545, in main
return gyp_main(args)
File "workerdepsgyppylibgyp\__init__.py", line 518, in gyp_main
[generator, flat_list, targets, data] = Load(
File "workerdepsgyppylibgyp\__init__.py", line 105, in Load
generator.CalculateVariables(default_variables, params)
File "workerdepsgyppylibgypgeneratormsvs.py", line 1934, in CalculateVariables
msvs_version = MSVSVersion.SelectVisualStudioVersion(
File "workerdepsgyppylibgypMSVSVersion.py", line 498, in SelectVisualStudioVersion
return _CreateVersion(msvs_version, override_path, sdk_based=True)
File "workerdepsgyppylibgypMSVSVersion.py", line 377, in _CreateVersion
return versions[str(name)]
打开MSVSVersion.py,找到return versions[str(name)],改成return versions[str('2019')]
vs2019打开node_modules/mediasoup/worker下的mediasoup-worker.sln
菜单栏下面选择Release Win32
在点击生成->生成解决方案 , 等待
查看worker是否生成out和Release文件
完
参考
Mediasoup unable to install in Windows
无法找到 Visual Studio 2010 的生成工具(平台工具集 =“v100”)
使用visual studio 2017/2019 打开项目,点击菜单栏-项目-重定目标解决方案,然后会提示修改版本,然后只修改版本