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.