# Why is there an error when running the command "npm i mediasoup@3" error on windows?

**URL:** <https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008>\
**Category:** mediasoup libraries\
**Created:** [March 9, 2022, 9:22am UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008 "2022-03-09T09:22:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![conorh](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@conorh](https://mediasoup.discourse.group/u/conorh)\
**Post date:** [March 9, 2022, 9:22am UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/1 "2022-03-09T09:22:16Z")

</div>

Trying to install the mediasoup library on a Windows machine via:

`npm install mediasoup@3`

The app that needs this library is being developed on a MacOS machine and works fine when being installed. The live app will be hosted on a Windows Server.

When running the command in an empty npm folder on the Windows machine, it returns the following error.

```auto
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm ERR! code 1
npm ERR! path D:\hostingspaces\test\livebidding\node_modules\mediasoup
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node npm-scripts.js postinstall
npm ERR! npm-scripts.js [INFO] running task "postinstall"
npm ERR! npm-scripts.js [INFO] executing command: node npm-scripts.js worker:build
npm ERR! npm-scripts.js [INFO] running task "worker:build"
npm ERR! npm-scripts.js [INFO] executing command: make -C worker
npm ERR! make: Entering directory 'D:/hostingspaces/test/livebidding/node_modules/mediasoup/worker'
npm ERR! # Updated pip and setuptools are needed for meson
npm ERR! make: Leaving directory 'D:/hostingspaces/test/livebidding/node_modules/mediasoup/worker'
npm ERR! process_begin: CreateProcess(NULL, dirname D:/hostingspaces/test/livebidding/node_modules/mediasoup/worker/Makefile, ...) failed.
npm ERR! Makefile:7: pipe: No error
npm ERR! process_begin: CreateProcess(NULL, pwd, ...) failed.
npm ERR! Makefile:37: pipe: No error
npm ERR! process_begin: CreateProcess(NULL, pwd, ...) failed.
npm ERR! Makefile:56: pipe: No error
npm ERR! The system cannot find the path specified.
npm ERR! process_begin: CreateProcess(NULL, pwd, ...) failed.
npm ERR! Makefile:62: pipe: Bad file descriptor
npm ERR! The system cannot find the path specified.
npm ERR! process_begin: CreateProcess(NULL, pwd, ...) failed.
npm ERR! Makefile:62: pipe: Bad file descriptor
npm ERR! The system cannot find the path specified.
npm ERR! process_begin: CreateProcess(NULL, pwd, ...) failed.
npm ERR! Makefile:65: pipe: Bad file descriptor
npm ERR! '[' is not recognized as an internal or external command,
npm ERR! operable program or batch file.
npm ERR! process_begin: CreateProcess(NULL, pwd, ...) failed.
npm ERR! Makefile:28: pipe: Bad file descriptor
npm ERR! process_begin: CreateProcess(NULL, # Updated pip and setuptools are needed for meson, ...) failed.
npm ERR! make (e=2): The system cannot find the file specified.
npm ERR! make: *** [Makefile:57: meson-ninja] Error 2

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Local\npm-cache\_logs\2022-03-08T11_27_43_896Z-debug.log

```

I have node, python, pip, and GNU make installed on the machine.

Is there something else that needs to be configured or why is this error being shown?

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [March 9, 2022, 8:13pm UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/2 "2022-03-09T20:13:53Z")

</div>

Please read the docs first: [mediasoup :: Installation](https://mediasoup.org/documentation/v3/mediasoup/installation/)

---

<div class="post-metadata">

**Author:** ![conorh](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@conorh](https://mediasoup.discourse.group/u/conorh)\
**Post date:** [March 10, 2022, 9:29am UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/3 "2022-03-10T09:29:34Z")

</div>

I have followed the installation guide to get to this point and this is the error I am still getting.

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [March 10, 2022, 1:59pm UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/4 "2022-03-10T13:59:25Z")

</div>

According to logs you don’t have correct Make version, which in turn means you didn’t follow all installation instructions 😞

---

<div class="post-metadata">

**Author:** ![snnz](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/snnz/32/693_2.png) [@snnz](https://mediasoup.discourse.group/u/snnz)\
**Post date:** [March 10, 2022, 7:53pm UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/5 "2022-03-10T19:53:37Z")

</div>

By the way, if there is already a Make at the location that is in the PATH, then it will continue to run even if the instructions are followed, and Msys folder is appended _to the end_ of the PATH.

---

<div class="post-metadata">

**Author:** ![BronzedBroth](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@BronzedBroth](https://mediasoup.discourse.group/u/BronzedBroth)\
**Post date:** [March 10, 2022, 11:47pm UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/6 "2022-03-10T23:47:58Z")

</div>

I feel this topic comes up too much, is there a possibility someone with a clean install of windows could walk us through from which applications to use/what to install, how to install.

Would make for great documentation and a mass majority of users use windows but don’t understand these steps clearly. I certainly don’t use windows or I would help lots but if someone can cover this in a new post I’m sure it’d be widely used!!!

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [March 11, 2022, 12:30am UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/7 "2022-03-11T00:30:17Z")

</div>

Longer term solution would be to have [Replace Makefile with Python script · Issue #701 · versatica/mediasoup · GitHub](https://github.com/versatica/mediasoup/issues/701) to reduce dependencies, then just Node.js and Python would be required. But no one volunteered yet and I wasn’t in a mood either 🙂

---

<div class="post-metadata">

**Author:** ![snnz](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/snnz/32/693_2.png) [@snnz](https://mediasoup.discourse.group/u/snnz)\
**Post date:** [March 11, 2022, 12:30pm UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/8 "2022-03-11T12:30:08Z")

</div>

Wouldn’t it be easier, at least for the time being, just to use a Python script to download all necessary MSYS files to a temporary folder during installation? For example, this one downloads and extracts MSYS and make to the current folder:

```auto
import io, tarfile, urllib.request

def get(url):
  tar = tarfile.open(fileobj=io.BytesIO(urllib.request.urlopen(url).read()))
  tar.extractall()
  tar.close()

try:  
  get('https://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.19-1/msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz/download')
  get('https://sourceforge.net/projects/mingw/files/MSYS/Base/libiconv/libiconv-1.14-1/libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma/download')
  get('https://sourceforge.net/projects/mingw/files/MSYS/Base/gettext/gettext-0.18.1.1-1/libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma/download')
  get('https://sourceforge.net/projects/mingw/files/MSYS/Base/coreutils/coreutils-5.97-3/coreutils-5.97-3-msys-1.0.13-bin.tar.lzma/download')
  get('https://sourceforge.net/projects/mingw/files/MSYS/Base/make/make-3.81-3/make-3.81-3-msys-1.0.13-bin.tar.lzma/download')
except Exception as err:
  print('MSYS/make download error: ', err)

```

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [March 12, 2022, 1:47am UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/9 "2022-03-12T01:47:18Z")

</div>

That is an interesting hack, the challenge is we need to do it before calling makefile and all commands are done using said makefile 🙃

---

<div class="post-metadata">

**Author:** ![snnz](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/snnz/32/693_2.png) [@snnz](https://mediasoup.discourse.group/u/snnz)\
**Post date:** [March 12, 2022, 3:22am UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/10 "2022-03-12T03:22:02Z")

</div>

But we have `npm-scripts.js`. Suppose this script is in the `worker/scripts/getmake.py`:

```auto
import io, tarfile, urllib.request

def get(url):
  tar = tarfile.open(fileobj=io.BytesIO(urllib.request.urlopen(url).read()))
  tar.extractall('worker/out/msys')
  tar.close()

get('https://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/msys-1.0.19-1/msysCORE-1.0.19-1-msys-1.0.19-bin.tar.xz/download')
get('https://sourceforge.net/projects/mingw/files/MSYS/Base/libiconv/libiconv-1.14-1/libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma/download')
get('https://sourceforge.net/projects/mingw/files/MSYS/Base/gettext/gettext-0.18.1.1-1/libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma/download')
get('https://sourceforge.net/projects/mingw/files/MSYS/Base/coreutils/coreutils-5.97-3/coreutils-5.97-3-msys-1.0.13-bin.tar.lzma/download')
get('https://sourceforge.net/projects/mingw/files/MSYS/Base/make/make-3.81-3/make-3.81-3-msys-1.0.13-bin.tar.lzma/download')

```

Then in `npm-scripts.js`:

```auto
if (isWindows)
{
  const { spawnSync } = require('child_process');
  var res = spawnSync('where', ['python3.exe']);
  if (res.status !== 0)
  {
    res = spawnSync('where', ['python.exe']);
    if (res.status !== 0)
    {
      console.log('Cannot find Python executable.');
      process.exit(1);
    }
  }
  execute(`${String(res.stdout).trim()} worker\\scripts\\getmake.py`);
  process.env['PATH'] = process.cwd() + '\\worker\\out\\msys\\bin;' + process.env['PATH'];
}

```

And we have the correct version of `make` locally.

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [March 12, 2022, 3:43am UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/11 "2022-03-12T03:43:35Z")

</div>

I’ll have to replicate all that in Rust as well. Could be a short-term option. Feel free to contribute.

---

<div class="post-metadata">

**Author:** ![snnz](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/snnz/32/693_2.png) [@snnz](https://mediasoup.discourse.group/u/snnz)\
**Post date:** [March 12, 2022, 5:15am UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/12 "2022-03-12T05:15:50Z")

</div>

It turned out that a couple more files from MSYS were necessary for Meson, but all in all it worked pretty well. I’ll leave it as a PR in case someone is interested: [Download and use MSYS/make locally for Windows postinstall by snnz · Pull Request #792 · versatica/mediasoup · GitHub](https://github.com/versatica/mediasoup/pull/792)

---

<div class="post-metadata">

**Author:** ![Basti291](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Basti291](https://mediasoup.discourse.group/u/Basti291)\
**Post date:** [April 25, 2022, 5:02pm UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/13 "2022-04-25T17:02:24Z")

</div>

I have an similar error, it is definetly a wrong make version ? I installed the gnu make from the installation page and put the bin folder to the path variable.

 ![Unbenannt](https://global.discourse-cdn.com/free1/uploads/mediasoup/original/2X/9/9b59af05d031aaa619add9f62329f90513db3351.png)

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [April 25, 2022, 5:04pm UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/14 "2022-04-25T17:04:12Z")

</div>

Installation instructions tell you which version of make to install. They are, for some reason, all slightly different and not always compatible.

---

<div class="post-metadata">

**Author:** ![Basti291](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Basti291](https://mediasoup.discourse.group/u/Basti291)\
**Post date:** [April 27, 2022, 6:39am UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/15 "2022-04-27T06:39:10Z")

</div>

I dont see there which version i should use. I am on windows and dowlnoaded the gnu make from the link in the instructions. But i also tried with other make versions and same error

---

<div class="post-metadata">

**Author:** ![Basti291](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Basti291](https://mediasoup.discourse.group/u/Basti291)\
**Post date:** [April 27, 2022, 7:10am UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/16 "2022-04-27T07:10:16Z")

</div>

Another error, i have now:

 ![grafik](https://global.discourse-cdn.com/free1/uploads/mediasoup/original/2X/6/6424802992ab93ec10dd4c9aa714a86a5c8eff96.png)

---

<div class="post-metadata">

**Author:** ![Basti291](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Basti291](https://mediasoup.discourse.group/u/Basti291)\
**Post date:** [April 27, 2022, 8:30am UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/17 "2022-04-27T08:30:39Z")

</div>

![grafik](https://global.discourse-cdn.com/free1/uploads/mediasoup/original/2X/4/46e7730c88734336258e9089d4f7bac3a41de2cb.png)  
my make verson

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [April 27, 2022, 12:51pm UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/18 "2022-04-27T12:51:21Z")

</div>

No need to try another make. Just install one provided in docs and make sure to add to PATH as in instructions too and it’ll work.

---

<div class="post-metadata">

**Author:** ![Basti291](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Basti291](https://mediasoup.discourse.group/u/Basti291)\
**Post date:** [April 27, 2022, 1:04pm UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/19 "2022-04-27T13:04:55Z")

</div>

As i said, i installed the make version from the link on the installation page ([MinGW - Minimalist GNU for Windows download | SourceForge.net](https://sourceforge.net/projects/mingw/))  
I also added `C:\MinGW\msys\1.0\bin`, which is the right location on my computer to PATH variable

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [April 27, 2022, 3:53pm UTC](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008/20 "2022-04-27T15:53:01Z")

</div>

This is correct, what is the latest error you’re getting?

[Next page](https://mediasoup.discourse.group/t/why-is-there-an-error-when-running-the-command-npm-i-mediasoup-3-error-on-windows/4008.md?page=2)
