I want to deploy my custom mediasoup server on Google Cloud and use it for my videocalling app on Flutter. I have followed
https://github.com/versatica/mediasoup-demo
I have done the following so far:
Clone the project: $ git clone https://github.com/versatica/mediasoup-demo.git $ cd mediasoup-demo $ git checkout v3 Ensure you have installed the dependencies required by mediasoup to build.
Set up the mediasoup-demo server:
$ cd server $ npm install
But when I do npm install I get
Upgrade to chokidar 3 with 15x fewer dependencies
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /usr/local/Cellar/node/21.7.1/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/arjunbhilare/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! > mediasoup@3.14.1 postinstall
npm ERR! > node npm-scripts.mjs postinstall
npm ERR!
npm ERR! npm-scripts.mjs [INFO] [postinstall]
npm ERR! npm-scripts.mjs [INFO] [postinstall] downloadPrebuiltWorker() [tarUrl:https://github.com/versatica/mediasoup/releases/download/3.14.1/mediasoup-worker-3.14.1-darwin-x64.tgz]
npm ERR! npm-scripts.mjs [INFO] [postinstall] ensureDir() [dir:worker/prebuild]
npm ERR! npm-scripts.mjs [INFO] [postinstall] ensureDir() [dir:worker/out/Release]
npm ERR! npm-scripts.mjs [INFO] [postinstall] downloadPrebuiltWorker() | got mediasoup-worker prebuilt binary
npm ERR! npm-scripts.mjs [INFO] [postinstall] downloadPrebuiltWorker() | checking fetched mediasoup-worker prebuilt binary in current host
npm ERR! npm-scripts.mjs [INFO] [postinstall] downloadPrebuiltWorker() | fetched mediasoup-worker prebuilt binary is valid for current host
npm ERR!
npm ERR! > mediasoup@3.14.1 prepare
npm ERR! > node npm-scripts.mjs prepare
npm ERR!
npm ERR! npm-scripts.mjs [INFO] [prepare]
npm ERR! npm-scripts.mjs [INFO] [prepare] flatcNode()
npm ERR! npm-scripts.mjs [INFO] [prepare] installInvoke()
npm ERR! npm-scripts.mjs [INFO] [prepare] executeCmd(): "python3" -m pip install --upgrade --no-user --target "/Users/arjunbhilare/.npm/_cacache/tmp/git-clonetzPFjK/worker/pip_invoke" invoke
npm ERR! Collecting invoke
npm ERR! Using cached invoke-2.2.0-py3-none-any.whl.metadata (3.3 kB)
npm ERR! Using cached invoke-2.2.0-py3-none-any.whl (160 kB)
npm ERR! Installing collected packages: invoke
npm ERR! Successfully installed invoke-2.2.0
npm ERR! npm-scripts.mjs [INFO] [prepare] executeCmd(): "python3" -m invoke -r worker flatc
npm ERR! "/Library/Frameworks/Python.framework/Versions/3.12/bin/python3" -m pip install --upgrade --no-user --target "/Users/arjunbhilare/.npm/_cacache/tmp/git-clonetzPFjK/worker/out/pip_meson_ninja" pip setuptools
npm ERR! Collecting pip
npm ERR! Using cached pip-24.0-py3-none-any.whl.metadata (3.6 kB)
npm ERR! Collecting setuptools
npm ERR! Using cached setuptools-69.2.0-py3-none-any.whl.metadata (6.3 kB)
npm ERR! Using cached pip-24.0-py3-none-any.whl (2.1 MB)
npm ERR! Using cached setuptools-69.2.0-py3-none-any.whl (821 kB)
npm ERR! Installing collected packages: setuptools, pip
npm ERR! Successfully installed pip-24.0 setuptools-69.2.0
npm ERR! "/Library/Frameworks/Python.framework/Versions/3.12/bin/python3" -m pip install --upgrade --no-user --target "/Users/arjunbhilare/.npm/_cacache/tmp/git-clonetzPFjK/worker/out/pip_meson_ninja" meson==1.3.0 ninja==1.10.2.4
npm ERR! Collecting meson==1.3.0
npm ERR! Using cached meson-1.3.0-py3-none-any.whl.metadata (1.8 kB)
npm ERR! Collecting ninja==1.10.2.4
npm ERR! Using cached ninja-1.10.2.4-py2.py3-none-macosx_10_9_universal2.macosx_10_9_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl.metadata (5.3 kB)
npm ERR! Using cached meson-1.3.0-py3-none-any.whl (976 kB)
npm ERR! Using cached ninja-1.10.2.4-py2.py3-none-macosx_10_9_universal2.macosx_10_9_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl (231 kB)
npm ERR! Installing collected packages: ninja, meson
npm ERR! Successfully installed meson-1.3.0 ninja-1.10.2.4
npm ERR! cd "/Users/arjunbhilare/.npm/_cacache/tmp/git-clonetzPFjK/worker" && "/Users/arjunbhilare/.npm/_cacache/tmp/git-clonetzPFjK/worker/out/pip_meson_ninja/bin/meson" setup --prefix "/Users/arjunbhilare/.npm/_cacache/tmp/git-clonetzPFjK/worker/out/Release" --bindir "" --libdir "" --buildtype release -Db_ndebug=true "/Users/arjunbhilare/.npm/_cacache/tmp/git-clonetzPFjK/worker/out/Release/build"
npm ERR! The Meson build system
npm ERR! Version: 1.3.0
npm ERR! Source dir: /Users/arjunbhilare/.npm/_cacache/tmp/git-clonetzPFjK/worker
npm ERR! Build dir: /Users/arjunbhilare/.npm/_cacache/tmp/git-clonetzPFjK/worker/out/Release/build
npm ERR! Build type: native build
npm ERR! Project name: mediasoup-worker
npm ERR! Project version: undefined
npm ERR! C compiler for the host machine: cc (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.1.0.2.5)")
npm ERR! C linker for the host machine: cc ld64 1022.1
npm ERR! C++ compiler for the host machine: c++ (clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.1.0.2.5)")
npm ERR! C++ linker for the host machine: c++ ld64 1022.1
npm ERR! Host machine cpu family: x86_64
npm ERR! Host machine cpu: x86_64
npm ERR! Checking for function "strtoull_l" : YES
npm ERR! Downloading openssl source from https://www.openssl.org/source/openssl-3.0.8.tar.gz
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR! WARNING: failed to download with error: could not get https://www.openssl.org/source/openssl-3.0.8.tar.gz is the internet available?. Trying after a delay...
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR! WARNING: failed to download with error: could not get https://www.openssl.org/source/openssl-3.0.8.tar.gz is the internet available?. Trying after a delay...
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR! WARNING: failed to download with error: could not get https://www.openssl.org/source/openssl-3.0.8.tar.gz is the internet available?. Trying after a delay...
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR! WARNING: failed to download with error: could not get https://www.openssl.org/source/openssl-3.0.8.tar.gz is the internet available?. Trying after a delay...
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR! WARNING: failed to download with error: could not get https://www.openssl.org/source/openssl-3.0.8.tar.gz is the internet available?. Trying after a delay...
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR! Downloading openssl source from https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-2/openssl-3.0.8.tar.gz
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR! WARNING: failed to download with error: could not get https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-2/openssl-3.0.8.tar.gz is the internet available?. Trying after a delay...
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR! WARNING: failed to download with error: could not get https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-2/openssl-3.0.8.tar.gz is the internet available?. Trying after a delay...
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR! WARNING: failed to download with error: could not get https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-2/openssl-3.0.8.tar.gz is the internet available?. Trying after a delay...
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR! WARNING: failed to download with error: could not get https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-2/openssl-3.0.8.tar.gz is the internet available?. Trying after a delay...
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR! WARNING: failed to download with error: could not get https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-2/openssl-3.0.8.tar.gz is the internet available?. Trying after a delay...
npm ERR! <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>
npm ERR!
npm ERR! meson.build:178:15: ERROR: could not get https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-2/openssl-3.0.8.tar.gz is the internet available?
npm ERR!
npm ERR! A full log can be found at /Users/arjunbhilare/.npm/_cacache/tmp/git-clonetzPFjK/worker/out/Release/build/meson-logs/meson-log.txt
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm-scripts.mjs [ERROR] [prepare] executeCmd() failed, exiting: Error: Command failed: "python3" -m invoke -r worker flatc
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path /Users/arjunbhilare/.npm/_cacache/tmp/git-clonetzPFjK
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command sh /var/folders/x7/0zpl2q211l57djjvsxdgrm_c0000gp/T/prepare-4f5bba10.sh
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /Users/arjunbhilare/.npm/_logs/2024-04-11T10_27_19_874Z-debug-0.log
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/arjunbhilare/.npm/_logs/2024-04-11T10_26_39_038Z-debug-0.log
How to resolve this? Also how to configure a tls certificate? which is the next step after npm install
Could someone please help me with this?
I tried replicating your issue on a fresh VM in Compute Engine, but I was able to successfully execute npm install
. Most probably, you have the wrong packages and libraries installed. Here are the steps I did:
VM config:
e2-medium
1 GB Memory
10 GB Disk
Debian 12 Bookworm
Step 1: $ sudo apt update
Step 2: Install python3
$ sudo apt install python3 python3-pip
Step 3: Install node.js
$ sudo apt-get install nodejs
$ sudo apt install npm
Step 4: Double check the versions installed
$ python3 --version
$ nodejs -v
$ npm -v
python3 - Python 3.11.2
node.js - v18.19.0
npm - 9.2.0
Note that these versions are important as they are required by mediasoup to build, as stated in the installation steps.
Follow the steps again. Once you get to the $ npm install part
, wait around 20-30 minutes then it should install successfully.
Also how to configure a tls certificate?
After $ npm install
, the next step is to copy config.example.js
as config.js
. In config.js
you will put here the TLS certificate details. There are free TLS providers like Let's Encrypt.
In the GitHub doc, click on the TLS certificates link, which should point to line 24 of the config.js
file.