- 克隆项目:
gavin@gavin-vm:~/Documents$ git clone https://github.com/versatica/mediasoup-demo.git
gavin@gavin-vm:~/Documents$ cd mediasoup-demo
gavin@gavin-vm:~/Documents/mediasoup-demo$ sudo git checkout v3
- 设置 mediasoup-demo server:
gavin@gavin-vm:~/Documents/mediasoup-demo/server$ cd server
gavin@gavin-vm:~/Documents/mediasoup-demo/server$ npm install
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN checkPermissions Missing write access to /home/gavin/Documents/mediasoup-demo/server/node_modules
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! path /home/gavin/Documents/mediasoup-demo/server/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/home/gavin/Documents/mediasoup-demo/server/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/home/gavin/Documents/mediasoup-demo/server/node_modules'] {
npm ERR! stack: 'Error: EACCES: permission denied, access ' +
npm ERR! "'/home/gavin/Documents/mediasoup-demo/server/node_modules'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/home/gavin/Documents/mediasoup-demo/server/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /home/gavin/.npm/_logs/2022-04-15T11_47_53_184Z-debug.log
参考npm install报错:npm ERR! Error: EACCES: permission denied.gyp ERR! configure error获得解决办法:
gavin@gavin-vm:~/Documents/mediasoup-demo/server$ sudo npm install --unsafe-perm
出现如下信息表示安装完成:
- 将 config.example.js 复制为 config.js:
gavin@gavin-vm:~/Documents/mediasoup-demo/server$ cp config.example.js config.js
- 针对您的方案对 config.js 进行自定义,左侧为原始文件,右侧为修改后文件:
执行sudo npm install可能出现错误:
gavin@gavin-vm:~/Documents/mediasoup-demo/server$ sudo npm install
...
socket.timeout: The read operation timed out
Storing debug log for failure in /home/gavin/.pip/pip.log
Installation 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.
/usr/bin/python3 -m pip install --upgrade --target=/home/gavin/Documents/mediasoup-demo/server/node_modules/mediasoup/worker/out/pip meson ninja
...
socket.timeout: The read operation timed out
Storing debug log for failure in /home/gavin/.pip/pip.log
make: *** [meson-ninja] Error 2
make: Leaving directory `/home/gavin/Documents/mediasoup-demo/server/node_modules/mediasoup/worker'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mediasoup@3.9.9 postinstall: `node npm-scripts.js postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mediasoup@3.9.9 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! /home/gavin/.npm/_logs/2022-04-14T16_01_16_615Z-debug.log
参考socket.timeout: The read operation timed out 更改pip源至国内镜像,显著提升下载速度及Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificat,获得解决办法:
gavin@gavin-vm:~/Downloads$ gedit ~/.pip/pip.conf
输入并保存:
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
执行sudo npm install可能出现错误:
/usr/bin/python3 -m pip install --upgrade --target=/home/gavin/Documents/mediasoup-demo/node_modules/mediasoup/worker/out/pip meson ninja
/usr/bin/python3: Error while finding spec for 'pip.__main__' (<class 'ImportError'>: No module named 'typing'); 'pip' is a package and cannot be directly executed
make: *** [meson-ninja] Error 1
make: Leaving directory `/home/gavin/Documents/mediasoup-demo/node_modules/mediasoup/worker'
npm WARN enoent ENOENT: no such file or directory, open '/home/gavin/Documents/mediasoup-demo/package.json'
npm WARN mediasoup-demo No description
npm WARN mediasoup-demo No repository field.
npm WARN mediasoup-demo No README data
npm WARN mediasoup-demo No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mediasoup@3.9.9 postinstall: `node npm-scripts.js postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mediasoup@3.9.9 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! /home/gavin/.npm/_logs/2022-04-15T04_32_58_503Z-debug.log
参考No module named pip.__main__; ‘pip‘ is a package and cannot be directly executed
获得解决办法,又出现问题:
gavin@gavin-vm:~/Documents/mediasoup-demo$ python -m ensurepip
/usr/bin/python: No module named ensurepip
参考ModuleNotFoundError: No module named ‘pip‘ 并且 No module named ensurepip
获得解决办法,又出现问题:
gavin@gavin-vm:~/Downloads$ wget -c https://bootstrap.pypa.io/get-pip.py
gavin@gavin-vm:~/Downloads$ python get-pip.py
ERROR: This script does not work on Python 2.7 The minimum supported Python version is 3.7. Please use https://bootstrap.pypa.io/pip/2.7/get-pip.py instead.
参照ubuntu安装python3.7,并更新python默认指向为python3.7,安装Python-3.8.0。
安装完毕后,重新执行,又出现问题:
gavin@gavin-vm:~/Downloads$ python get-pip.py
...
ERROR: Could not find a version that satisfies the requirement pip (from versions: none)
ERROR: No matching distribution found for pip
...
参考socket.timeout: The read operation timed out 更改pip源至国内镜像,显著提升下载速度及Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificat,获得解决办法:
gavin@gavin-vm:~/Downloads$ gedit ~/.pip/pip.conf
输入并保存:
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
重新执行成功:
gavin@gavin-vm:~/Downloads$ python get-pip.py
...
Successfully installed pip-22.0.4 wheel-0.37.1
...
重新执行成功:
gavin@gavin-vm:~/Documents/mediasoup-demo$ python -m ensurepip
...
Requirement already satisfied: setuptools in /usr/local/lib/python3.8/site-packages (41.2.0)
Requirement already satisfied: pip in /home/gavin/.local/lib/python3.8/site-packages (22.0.4)
重新执行,又出现问题:
gavin@gavin-vm:~/Documents/mediasoup-demo$ npm install mediasoup@3 --save
...
Downloading openssl source from https://www.openssl.org/source/openssl-1.1.1l.tar.gz
<urlopen error unknown url type: https>
WARNING: failed to download with error: could not get https://www.openssl.org/source/openssl-1.1.1l.tar.gz is the internet available?. Trying after a delay...
...
meson.build:147:0: ERROR: could not get https://www.openssl.org/source/openssl-1.1.1l.tar.gz is the internet available?
A full log can be found at /home/gavin/Documents/mediasoup-demo/node_modules/mediasoup/worker/out/Release/build/meson-logs/meson-log.txt
make: *** [setup] Error 1
make: Leaving directory `/home/gavin/Documents/mediasoup-demo/node_modules/mediasoup/worker'
npm WARN enoent ENOENT: no such file or directory, open '/home/gavin/Documents/mediasoup-demo/package.json'
npm WARN mediasoup-demo No description
npm WARN mediasoup-demo No repository field.
npm WARN mediasoup-demo No README data
npm WARN mediasoup-demo No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mediasoup@3.9.9 postinstall: `node npm-scripts.js postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mediasoup@3.9.9 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! /home/gavin/.npm/_logs/2022-04-15T08_31_50_366Z-debug.log
urllib2.URLError: <urlopen error unknown url type: https>
可能出现:
解决方案:
sudo apt-get install python3-pip
- 创建目录 certs:
mkdir certs
- 将证书及密钥复制至 certs:
cp /srv/ftp/certs/* certs/
- 设置 mediasoup-demo 浏览器 app:
cd ../app
sudo npm install
出现如下信息表示安装完成:
- 在终端中运行 Node.js 服务器应用程序:
cd ../server
sudo npm start
- 在另一个终端中,构建并运行浏览器应用程序:
cd ../app
sudo npm start
本地终端上执行以下操作:
- 浏览器输入https://domain-name:3000
参考链接:https://github.com/versatica/mediasoup-demo
本机上部署mediasoup