cannot install on new debian9

Brand new
Description: Debian GNU/Linux 9.11 (stretch)
Release: 9.11

build-essential : installed
node -v : v13.7.0
GNU Make 4.1

npm install mediasoup@2

unziping /root/.clang-tools/clang-tools-r298696-linux.tgz

mediasoup@2.6.19 postinstall /var/www/html/media.jmsinternet.com/node/node_modules/mediasoup
make Release -C worker

make: Entering directory '/var/www/html/node/node_modules/mediasoup/worker'
/usr/bin/python2 ./scripts/configure.py -R mediasoup-worker
You need to install gyp in deps/gyp first, run:
  ./scripts/get_dep.sh gyp
Makefile:23: recipe for target 'Release' failed
make: *** [Release] Error 42
make: Leaving directory '/var/www/html/node/node_modules/mediasoup/worker'
npm WARN enoent ENOENT: no such file or directory, open '/var/www/html/node/package.json'
npm WARN node No description
npm WARN node No repository field.
npm WARN node No README data
npm WARN node No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mediasoup@2.6.19 postinstall: `make Release -C worker`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the mediasoup@2.6.19 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!     /root/.npm/_logs/2020-01-29T16_01_01_078Z-debug.log

The folder node/node_modules/mediasoup was not created

In the debug.log, I have the same error

Any idea ?

Clone the mediasoup repo, enter into it, git branch v2, and run “npm install”. And paste the log.

BTW does “npm install mediasoup@3” also fail?

I got exactly the same issue with v3

I tried:

git clone https://github.com/versatica/mediasoup
cd mediasoup
git branch v2
npm install

No errors

But node server.js gives me:
var mediasoup = require('mediasoup');

Error: Cannot find module ‘mediasoup’

Actually you must do “git checkout v2” rather than “branch”. Then “npm install”. Try again please.

Whether “require(mediasoup)” does not work is unrelated. That’s not how Node works, sorry.

In fact, better clone mediasoup repo again and run those steps.

And to clarify, I won’t explain why running “npm install” within a git repo is not enough for require(module) later work.

git clone https://github.com/versatica/mediasoup
cd mediasoup
git checkout v2
npm install

No errors…
But looks like I miss a step to compile the project

Enter into worker/ dir and run make.

make Release
make[1]: Entering directory '/mediasoup/worker'
/usr/bin/python2 ./scripts/configure.py -R mediasoup-worker
You need to install gyp in deps/gyp first, run:
  ./scripts/get_dep.sh gyp
Makefile:23: recipe for target 'Release' failed
make[1]: *** [Release] Error 42
make[1]: Leaving directory '/mediasoup/worker'
Makefile:19: recipe for target 'default' failed
make: *** [default] Error 2

pyhon2 and pyhon3 are installed by default

What? There is a worker/deps/gyp folder, right?

yes
/mediasoup/worker/deps/gyp

/mediasoup/worker/deps/gyp# ls
AUTHORS  buildbot  codereview.settings  data  DEPS  gyp  gyp.bat  gyp_main.py  gyptest.py  LICENSE  OWNERS  PRESUBMIT.py  pylib  README.md  samples  setup.py  test  tools

But there is no get_dep.sh on whole server

Actually it’s worker/scripts/get-dep.sh. anyway, try npm install mediasoup@3 please.

:/mediasoup/worker/scripts# ./get-dep.sh

[ERROR] get-dep.sh must be called from mediasoup/worker/ directory

I tried with v3 and same problems…

I tried manually

/mediasoup/worker# ./scripts/get-dep.sh gyp
>>> [INFO] getting dep 'gyp' ...
>>> [INFO] deleting deps/gyp ...
>>> [INFO] cloning https://chromium.googlesource.com/external/gyp.git ...
Cloning into 'deps/gyp'...
remote: Sending approximately 11.97 MiB ...
remote: Total 18473 (delta 11514), reused 18473 (delta 11514)
Receiving objects: 100% (18473/18473), 11.97 MiB | 0 bytes/s, done.
Resolving deltas: 100% (11514/11514), done.
>>> [INFO] setting 'master' git tag ...
>>> [INFO] adding dep source code to the repository ...
>>> [INFO] got dep 'gyp'
>>> [INFO] done
root@ns506571:/mediasoup/worker# make
make Release
make[1]: Entering directory '/mediasoup/worker'
/usr/bin/python2 ./scripts/configure.py -R mediasoup-worker
You need to install gyp in deps/gyp first, run:
  ./scripts/get_dep.sh gyp
Makefile:23: recipe for target 'Release' failed
make[1]: *** [Release] Error 42
make[1]: Leaving directory '/mediasoup/worker'
Makefile:19: recipe for target 'default' failed
make: *** [default] Error 2

Honestly no idea. I’ve tested in Debian 8.11 and Debian 10.1:

  • Debian 8.11

    • cat /etc/debian_version => 8.11
    • node -v => 8.16.0
    • python --version => Python 2.7.13
    • make -v => GNU Make 4.0
  • Debian 10.1

    • cat /etc/debian_version => 10.1
    • node -v => 10.15.2
    • python --version => Python 2.7.16
    • make -v => GNU Make 4.2.1

It works in both cases, so no idea what’s wrong with your host.

Try playing with worker/scripts/configure.py. That’s where the problem is happening. It seems that import gyp (which should find gyp into the path which includes deps/gyp/pylib) cannot find gyp module.

Try printing the path after:

sys.path.insert(0, os.path.join(root, 'deps', 'gyp', 'pylib'))
print("sys.path:", sys.path)

you should see something like ('sys.path:', ['./deps/gyp/pylib', 'xxxx', ...])

I just reformatted the server with Debian 10 and let you know if I get the same trouble.
(I remember I had it as well with Debian 8 with ovh.com last week)

The host I was using (ovh.com) was totally blank Debian 9 server (full dedicated powerful server)
But I installed certbot/letsencrypt and I know certbot installs some python packages. Now I will install mediasoup immediately as first package.

Thanks for your time

My Debian 8.11 is also a OVH host and I’ve also installed certbot/letsencrypt into it.

Please, add those lines into the configure.py file, otherwise it’s impossible to know where the error is.

maybe you installed cerbot AFTER mediasoup.
I will let you know with ALL steps in a pastebin on a new OVH Debian10 server
Regards

Worked fine with OVH and DEBIAN10.

Cool. Sad that you didn’t check what I said so we don’t know what was wrong in your Debian 9.