npm i mediasoup hangs/stuck

I installed mediasoup like any other package npm i mediasoup

nodejs version v18.12.1
npm version 8.19.2

the installation stuck on
reify:rxjs: timing reifyNode:node_modules/rxjs Completed in 15867ms

gcc --version
g++ --version
cc --version
c++ --version

gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 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.

g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 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.

cc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 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.

c++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 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.

Try with npm install --verbose to get to the bottom of the issue, some package might be stuck somewhere.

Also remove package-lock.json, node_modules then try npm install again. Try in another directory as well. Try some other terminal as well. Switch the network if you have any other. Finally some users reported downgrading node to solve such installation stuck issues.

@zaidiqbal Thank you for the suggestion. I tried everything you mentioned, however I kept the install to run overnight and ended up complete. It is not clear to me why installing the package takes very long time and seemed stuck. based on verbose log, the postinstall which takes most of the time

npm info run mediasoup@3.11.5 postinstall node_modules/mediasoup node npm-scripts.js postinstall
npm info run mediasoup@3.11.5 postinstall { code: 0, signal: null }
npm timing build:run:postinstall:node_modules/mediasoup Completed in 508948ms
npm timing build:run:postinstall Completed in 508949ms
npm timing build:deps Completed in 509076ms
npm timing build Completed in 509077ms
npm timing reify:build Completed in 509079ms
npm timing reify:trash Completed in 254ms
npm timing reify:save Completed in 0ms
npm timing reify Completed in 997716ms

Good to know, based upon the timing figures it took you around 20 minutes to completely install the package. That is above normal, it depends, sometimes for me based upon my machine it takes around 10-15 minutes, on server it is very quick.

Npm commands can be slow because of many reasons like some package taking more time than normal, may be npm server is slow at that time or may be there is misconfiguration or may be the directory has too many files or may be you are doing something in postinstall that is supposed to take that much time etc.

Timing on installation bases off how many cores you have. If already installed an image can take up to 60 seconds once configured. 20 - 30 minutes isn’t out of the question on single core machines. :slight_smile:

I run latest ubuntu always, I can say build-essentials and python3-pip is needed for most part or as long as I can recall ubuntu builds.

Hi everyone,

Right now I have the same problem. I removed node_modules and package-lock.json to be sure they don’t interfere. I am using npm update --verbose and here is the line where it gets stuck.

npm info run mediasoup@3.11.8 postinstall node_modules/mediasoup node npm-scripts.js postinstall
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 4196ms
(##################) ⠸ reify:mediasoup: http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 4196ms

For some reason, the call to https://registry.npmjs.org/-/npm/v1/security/advisories/bulk takes forever.

Here are my specs:

  • 1 GB Memory
  • 10 GB Disk / NYC1
  • Ubuntu 22.04 (LTS) x64
  • gcc version 11.3.0
  • Python 3.10.6
  • Node 19.6.0
  • npm 9.4.2

Finally, it completed. It just took a lot of time (about 20 minutes). Locally, we were talking about a matter of seconds. Wonder why it takes so much time on my test server…

Here are the final log lines following the lines where it was stuck (previous message).

npm info run mediasoup@3.11.8 postinstall { code: 0, signal: null }

added 26 packages, and audited 27 packages in 12m

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm verb exit 0
npm info ok 

I have an old ubuntu server, but I think it took more than I expected

How much time it took? Sometimes some specific package takes more time, it can happen.

around 30 mins.

have you ever used the demo?

I installed the app and server. it seems the server connects fine and I see local video, but no remote media is coming. Only black box.

Any idea?

Yes some time ago, back box issue is usually caused by the ip addresses not configured properly. You will have to provide public ip of your server in announced_ip and set ip to 0.0.0.0 in listen ips configurations. If you are on local then setting ip to 12.0.0.1 or your machines ip should work.

Check peer connections in chrome://webrtc-internals and see the candidate pairs on the top it will tell you much about the problem.

hi @zaidiqbal, Thank you for your help. I use public IP address under listenInfos => ip and announcedIp, however I think the issue with the port 44444. Do I need open the port range rtcMinPort - rtcMaxPort or just for the port under listenInfos => port?

I see a note
NOTE: mediasoup-demo/server/lib/Room.js will increase this port for
each mediasoup Worker since each Worker is a separate process.

it seems I need to keep a range open on the server, correct?

Also I would like to note that I am running the nodejs mediasoup server behind nginx. I changed the server in the demo from https to http, then ran it on locally on a port over http, then I did proxy the request by nginx. It seems to works and connects to http server and websocket. I am not sure about the UDP ports

I did fix the port issue and it works now, but video quality is really poor. not sure what driving the quality. any idea? Thanks

Great, check if both UDP/TCP ports are open, webrtc video quality is lower when on TCP, UDP is preferred. Check the quality of video you are capturing from camera using getUserMedia. Also verify the maxBitrate in encodings option for mediasoup it can limit the number of bits per second.

@zaidiqbal my local video is
codec: VP8
resolution: 1280x720

for remote video I am getting
codec: VP8
resolution: 320x180

I do have both TCP and UDP port open. Do you mean close TCP so I can enforce UDP?

for maxbit rate in RoomClient.js
// VP8 or H264 with simulcast.
else {
encodings = [
{
scaleResolutionDownBy: 1,
maxBitrate: 5000000,
scalabilityMode: this._webcamScalabilityMode || “L1T3”,
},
];

Client’s browser does this automatically in response to low performance of the connection.

Hi Snnz, what does that mean when you say “low performance of the connection”? internet bandwidth? the server specifications? server resources seems to be not fully utilized. Where is my starting point of investigations? any idea? or recommendations?

This means overall speed of the transmission from client to server, whatever it involves. Unstable WiFi, problems with router, internet bandwidth, even slow computer if both the client and the server are on the same machine.

@snnz What do you think about this trace? this is what I have during the video call

transport “trace” event [transportId:0a8ab785-45e1-47d7-a9a0-02cc64913210, trace.type:bwe, trace:{ direction: ‘out’, info: { availableBitrate: 6455466, desiredBitrate: 5000000, effectiveDesiredBitrate: 5000000, maxBitrate: 6750000, maxPaddingBitrate: 5737500, minBitrate: 30000, startBitrate: 6455466, type: ‘transport-cc’ }, timestamp: 1046582167, type: ‘bwe’ }] +741ms