# Cant install node-red-contrib-serial-modbus on Windows

**URL:** https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105
**Category:** General
**Tags:** function-node
**Created:** [19 March 2025 09:27 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105 "2025-03-19T09:27:09Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![vlado.krtolica](https://avatars.discourse-cdn.com/v4/letter/v/53a042/32.png) [@vlado.krtolica](https://discourse.nodered.org/u/vlado.krtolica)
#### Post date: [19 March 2025 09:27 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/1 "2025-03-19T09:27:09Z")

</div>

Hi to all,  
Sorry if this topic is already solved, i was looking for the solution but couldnt find one.

I am trying to install node " node-red-contrib-serial-modbus" but unsuccessfully.  
Below is the error i get.

Any help is much appreciated.

```auto
C:\Users\vkrtolica>npm install node-red-contrib-serial-modbus
npm warn deprecated npmlog@4.1.2: This package is no longer supported.
npm warn deprecated are-we-there-yet@1.1.7: This package is no longer supported.
npm warn deprecated gauge@2.7.4: This package is no longer supported.
npm warn cleanup Failed to remove some directories [
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\vkrtolica\\node_modules\\@serialport\\bindings',
npm warn cleanup [Error: EBUSY: resource busy or locked, rmdir 'C:\Users\vkrtolica\node_modules\@serialport\bindings'] {
npm warn cleanup errno: -4082,
npm warn cleanup code: 'EBUSY',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\vkrtolica\\node_modules\\@serialport\\bindings'
npm warn cleanup }
npm warn cleanup ],
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\vkrtolica\\node_modules\\prebuild-install',
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\vkrtolica\node_modules\prebuild-install\node_modules\readable-stream\lib\internal'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\vkrtolica\\node_modules\\prebuild-install\\node_modules\\readable-stream\\lib\\internal'
npm warn cleanup }
npm warn cleanup ],
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\vkrtolica\\node_modules\\node-red-contrib-serial-modbus\\node_modules',
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\vkrtolica\node_modules\node-red-contrib-serial-modbus\node_modules'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\vkrtolica\\node_modules\\node-red-contrib-serial-modbus\\node_modules'
npm warn cleanup }
npm warn cleanup ]
npm warn cleanup ]
npm error code 1
npm error path C:\Users\vkrtolica\node_modules\node-red-contrib-serial-modbus\node_modules\modbus-serial\node_modules\@serialport\bindings
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@9.4.1
npm error gyp info using node@22.12.0 | win32 | x64
npm error (node:9336) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
npm error (Use `node --trace-deprecation ...` to show where the warning was created)
npm error gyp info find Python using Python version 3.13.1 found at "C:\Python313\python.exe"
npm error gyp info find VS using VS2022 (17.13.35828.75) found at:
npm error gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
npm error gyp info find VS run with --verbose for detailed information
npm error gyp info spawn C:\Python313\python.exe
npm error gyp info spawn args [
npm error gyp info spawn args 'C:\\Users\\vkrtolica\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'msvs',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'C:\\Users\\vkrtolica\\node_modules\\node-red-contrib-serial-modbus\\node_modules\\modbus-serial\\node_modules\\@serialport\\bindings\\build\\config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'C:\\Users\\vkrtolica\\node_modules\\node-gyp\\addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'C:\\Users\\vkrtolica\\AppData\\Local\\node-gyp\\Cache\\22.12.0\\include\\node\\common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=C:\\Users\\vkrtolica\\AppData\\Local\\node-gyp\\Cache\\22.12.0',
npm error gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\vkrtolica\\node_modules\\node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\vkrtolica\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\22.12.0\\\\<(target_arch)\\\\node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=C:\\Users\\vkrtolica\\node_modules\\node-red-contrib-serial-modbus\\node_modules\\modbus-serial\\node_modules\\@serialport\\bindings',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'C:\\Users\\vkrtolica\\node_modules\\node-red-contrib-serial-modbus\\node_modules\\modbus-serial\\node_modules\\@serialport\\bindings\\build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error Traceback (most recent call last):
npm error File "C:\Users\vkrtolica\node_modules\node-gyp\gyp\gyp_main.py", line 42, in <module>
npm error import gyp # noqa: E402
npm error ^^^^^^^^^^
npm error File "C:\Users\vkrtolica\node_modules\node-gyp\gyp\pylib\gyp\ __init__.py", line 9, in <module>
npm error import gyp.input
npm error File "C:\Users\vkrtolica\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 19, in <module>
npm error from distutils.version import StrictVersion
npm error ModuleNotFoundError: No module named 'distutils'
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: `gyp` failed with exit code: 1
npm error gyp ERR! stack at ChildProcess.onCpExit (C:\Users\vkrtolica\node_modules\node-gyp\lib\configure.js:325:16)
npm error gyp ERR! stack at ChildProcess.emit (node:events:524:28)
npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm error gyp ERR! System Windows_NT 10.0.26100
npm error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\vkrtolica\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm error gyp ERR! cwd C:\Users\vkrtolica\node_modules\node-red-contrib-serial-modbus\node_modules\modbus-serial\node_modules\@serialport\bindings
npm error gyp ERR! node -v v22.12.0
npm error gyp ERR! node-gyp -v v9.4.1
npm error gyp ERR! not ok
npm error A complete log of this run can be found in: C:\Users\vkrtolica\AppData\Local\npm-cache\_logs\2025-03-19T09_19_59_449Z-debug-0.log

```

---

<div class="post-metadata">

### Author: ![vlado.krtolica](https://avatars.discourse-cdn.com/v4/letter/v/53a042/32.png) [@vlado.krtolica](https://discourse.nodered.org/u/vlado.krtolica)
#### Post date: [19 March 2025 09:35 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/2 "2025-03-19T09:35:16Z")

</div>

I tried running npm install --global windows-build-tools but again it cant do it.

```auto
C:\Windows\System32>npm install --global windows-build-tools
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated har-validator@5.1.5: this library is no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated windows-build-tools@5.2.2: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
npm warn cleanup Failed to remove some directories [
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\vkrtolica\\AppData\\Roaming\\npm\\node_modules\\windows-build-tools\\node_modules\\nugget',
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\vkrtolica\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\nugget'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\vkrtolica\\AppData\\Roaming\\npm\\node_modules\\windows-build-tools\\node_modules\\nugget'
npm warn cleanup }
npm warn cleanup ],
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\vkrtolica\\AppData\\Roaming\\npm\\node_modules\\windows-build-tools',
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\vkrtolica\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\vkrtolica\\AppData\\Roaming\\npm\\node_modules\\windows-build-tools\\node_modules'
npm warn cleanup }
npm warn cleanup ]
npm warn cleanup ]
npm error code 1
npm error path C:\Users\vkrtolica\AppData\Roaming\npm\node_modules\windows-build-tools
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node ./dist/index.js
npm error Downloading python-2.7.15.amd64.msi
npm error [>] 0.0% (0 B/s)
npm error ^[[1000D^[[0K^[[1A^[[1000D^[[0K^[[1A^[[1000D^[[0KDownloading python-2.7.15.amd64.msi
npm error [============================================>] 100.0% (0 B/s)
npm error ^[[1000D^[[0K^[[1A^[[1000D^[[0K^[[1A^[[1000D^[[0KDownloading python-2.7.15.amd64.msi
npm error [============================================>] 100.0% (0 B/s)
npm error Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\vkrtolica\.windows-build-tools\python-2.7.15.amd64.msi.
npm error
npm error
npm error ^[[1000D^[[0K^[[1A^[[1000D^[[0K^[[1A^[[1000D^[[0KDownloading vs_BuildTools.exe
npm error [>] 0.0% (0 B/s)
npm error ^[[1000D^[[0K^[[1A^[[1000D^[[0K^[[1A^[[1000D^[[0KDownloading vs_BuildTools.exe
npm error [============================================>] 100.0% (0 B/s)
npm error ^[[1000D^[[0K^[[1A^[[1000D^[[0K^[[1A^[[1000D^[[0KDownloading vs_BuildTools.exe
npm error [============================================>] 100.0% (0 B/s)
npm error Downloaded vs_BuildTools.exe. Saved to C:\Users\vkrtolica\.windows-build-tools\vs_BuildTools.exe.
npm error
npm error Starting installation...
npm error Downloading installers failed. Error: TypeError: 'process.env' only accepts a configurable, writable, and enumerable data descriptor
npm error at Function.defineProperty (<anonymous>)
npm error at Object.removePath (C:\Users\vkrtolica\AppData\Roaming\npm\node_modules\windows-build-tools\dist\utils\remove-path.js:11:12)
npm error at Object.install (C:\Users\vkrtolica\AppData\Roaming\npm\node_modules\windows-build-tools\dist\install\index.js:29:19)
npm error at C:\Users\vkrtolica\AppData\Roaming\npm\node_modules\windows-build-tools\dist\start.js:17:19
npm error at Object.download (C:\Users\vkrtolica\AppData\Roaming\npm\node_modules\windows-build-tools\dist\download.js:35:5)
npm error at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
npm error at async Object.aquireInstallers (C:\Users\vkrtolica\AppData\Roaming\npm\node_modules\windows-build-tools\dist\aquire-installers.js:32:13) {
npm error code: 'ERR_INVALID_OBJECT_DEFINE_PROPERTY'
npm error }
npm error windows-build-tools will now exit.
npm error (node:21856) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
npm error (Use `node --trace-deprecation ...` to show where the warning was created)
npm error A complete log of this run can be found in: C:\Users\vkrtolica\AppData\Local\npm-cache\_logs\2025-03-19T09_28_22_466Z-debug-0.log

```

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [19 March 2025 09:59 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/3 "2025-03-19T09:59:23Z")

</div>

> [@vlado.krtolica](#):
>
> ```auto
> C:\Users\vkrtolica>npm install node-red-contrib-serial-modbus
> 
> ```

1. Why are you installing that? It is very seriously out of date. The better & more up-to-date package is `node-red-contrib-modbus`
2. You are NOT in the right directory. You are in the user directory. Typically it would be `C:\Users\vkrtolica\.node-red`

> [@vlado.krtolica](#):
>
> ```auto
> C:\Windows\System32>npm install --global windows-build-tools
> 
> ```

1. This is not required and is depreciated. The correct way to do this is to tick the box to install necessary tools when you install NodeJS  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/9/69489c89bff3da40aac87e1c64f6381b3b01d695.png)
2. You get the EPERM permissions issue because to run `npm -g` it needs an administrative command prompt.

---

<div class="post-metadata">

### Author: ![vlado.krtolica](https://avatars.discourse-cdn.com/v4/letter/v/53a042/32.png) [@vlado.krtolica](https://discourse.nodered.org/u/vlado.krtolica)
#### Post date: [19 March 2025 10:19 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/4 "2025-03-19T10:19:30Z")

</div>

Hi Steve,

My goal is to use node-red app as Modbus RTU master, to poll data from some ModbusRTU slave devices.  
I understood that `node-red-contrib-modbus` can act only as ModbusRTU slave.

I did also installation of Node.js with selected `Automatically install the necessary tools`, still the result is the same.

I run command prompt as Administrator.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [19 March 2025 10:29 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/5 "2025-03-19T10:29:16Z")

</div>

> [@vlado.krtolica](#):
>
> I understood that `node-red-contrib-modbus` can act only as ModbusRTU slave.

It can be a server/slave or a client/master. The most typical use for `node-red-contrib-modbus` is to read values from modbus server/slave.

> [@vlado.krtolica](#):
>
> I run command prompt as Administrator.

Do you mean you used an Account with Administrator permissions or you ran the cmd prompt with "Run as Administrator"? (there is a difference)

* * *

Long story short. Avoid `node-red-contrib-serial-modbus` its dependancies for `serialport` are for v7.x [6 years old]. The current version of `serialport` is v13 [Released 3m ago]

---

<div class="post-metadata">

### Author: ![vlado.krtolica](https://avatars.discourse-cdn.com/v4/letter/v/53a042/32.png) [@vlado.krtolica](https://discourse.nodered.org/u/vlado.krtolica)
#### Post date: [19 March 2025 10:36 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/6 "2025-03-19T10:36:32Z")

</div>

I selected

> Run as Administrator

to run the command prompt.

Since you said i could use `node-red-contrib-modbus` to act as ModbusRTU master and read the data from slaves, I will investigate this option further. I thought it can act only as a slave.

Thanks a lot for you for your assistance Steve!

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [19 March 2025 11:08 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/7 "2025-03-19T11:08:52Z")

</div>

> [@vlado.krtolica](#):
>
> I run command prompt as Administrator.

You should not be doing that for Windows installations.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [19 March 2025 11:51 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/8 "2025-03-19T11:51:45Z")

</div>

> [@TotallyInformation](#):
>
> > [@vlado.krtolica](#):
> >
> > I run command prompt as Administrator.
> 
> You should not be doing that for Windows installations

By default, npm global installation require admin privileges.

but for the local .node-red installs, no, the OP should not. The reason the OP got an error would likely be due to running `npm install` in the wrong directory

> [@Steve-Mcl](#):
>
> > [@vlado.krtolica](#):
> >
> > ```auto
> > C:\Users\vkrtolica>npm install node-red-contrib-serial-modbus
> > 
> > ```
> 
> 1. Why are you installing that? It is very seriously out of date. The better & more up-to-date package is `node-red-contrib-modbus`
> 2. You are NOT in the right directory. You are in the user directory. Typically it would be `C:\Users\vkrtolica\.node-red`

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [19 March 2025 17:22 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/9 "2025-03-19T17:22:28Z")

</div>

> [@Steve-Mcl](#):
>
> By default, npm global installation require admin privileges.

It is different in Windows:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/e/eedab1397505c5727763464682e845201c1e81a7.png)

You don't need and should not typically run a global npm install from an admin PowerShell.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [19 March 2025 17:24 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/10 "2025-03-19T17:24:48Z")

</div>

> [@TotallyInformation](#):
>
> > [@Steve-Mcl](#):
> >
> > By default, npm global installation require admin privileges.
> 
> It is different in Windows:

Ah, yes. I was mixing it up with linux. On systems I used to look after, we moved npm global to be truly global (and protected)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [19 March 2025 17:26 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/11 "2025-03-19T17:26:16Z")

</div>

> [@Steve-Mcl](#):
>
> Ah, yes. I was mixing it up with linux. On systems I used to look after, we moved npm global to be truly global (and protected)

Indeed, and you do need sudo for a global install on a properly configured Linux/MacOS box. Doing so on Windows will likely result in odd permissions issues.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [17 June 2025 17:27 UTC](https://discourse.nodered.org/t/cant-install-node-red-contrib-serial-modbus-on-windows/96105/12 "2025-06-17T17:27:14Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
