pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

Windows 11: Error: spawn wmic ENOENT

Open oplexz opened this issue 3 years ago • 4 comments

What's going wrong?

Error caught while calling pidusage
PM2      | Error: Error: spawn wmic ENOENT
PM2      |     at ChildProcess.<anonymous> (C:\Users\Daniil\AppData\Roaming\npm\node_modules\pm2\node_modules\pidusage\lib\bin.js:33:10)
PM2      |     at ChildProcess.emit (node:events:526:28)
PM2      |     at ChildProcess.emit (node:domain:475:12)
PM2      |     at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
PM2      |     at onErrorNT (node:internal/child_process:476:16)
PM2      |     at processTicksAndRejections (node:internal/process/task_queues:83:21)

How could we reproduce this issue?

  1. ecosystem.config.js
module.exports = {
    apps: [{
        name: "tg-steam-2fa",
        script: "./index.js",
        watch: true
    }]
}
  1. pm2 start ecosystem.config.js

Supporting information

This issue has been reported before (#3873, #4954).

I'm running Windows 11 (build 22557.ni_release.220210-1445), and it appears that wmic has been deprecated in Windows 11 dev builds.

--- PM2 report ----------------------------------------------------------------
Date                 : Mon Feb 21 2022 17:23:40 GMT+0300 (Moscow Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.2.0
node version         : 17.5.0
node path            : not found
argv                 : C:\Program Files\nodejs\node.exe,C:\Users\Daniil\AppData\Roaming\npm\node_modules\pm2\lib\Daemon.js
argv0                : node
user                 : undefined
uid                  : N/A
gid                  : N/A
uptime               : 26min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.2.0
node version         : 17.5.0
node path            : not found
argv                 : C:\Program Files\nodejs\node.exe,C:\Users\Daniil\AppData\Roaming\npm\node_modules\pm2\bin\pm2,report
argv0                : node
user                 : Daniil
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : win32
type                 : Windows_NT
cpus                 : Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz
cpus nb              : 8
freemem              : 1984905216
totalmem             : 8464355328
home                 : C:\Users\Daniil
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬─────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name            │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼─────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ tg-steam-2fa    │ default     │ 1.0.0   │ fork    │ 10936    │ 24m    │ 0    │ online    │ 0%       │ 0b       │
 Daniil   │ disabled │
└─────┴─────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
C:\Users\Daniil\.pm2\pm2.log last 20 lines:
PM2        | 2022-02-21T17:19:34: PM2 error: Error caught while calling pidusage
PM2        | 2022-02-21T17:19:34: PM2 error: Error: Error: spawn wmic ENOENT
PM2        | 2022-02-21T17:20:04: PM2 error: Error caught while calling pidusage
PM2        | 2022-02-21T17:20:04: PM2 error: Error: Error: spawn wmic ENOENT
PM2        | 2022-02-21T17:20:34: PM2 error: Error caught while calling pidusage
PM2        | 2022-02-21T17:20:34: PM2 error: Error: Error: spawn wmic ENOENT
PM2        | 2022-02-21T17:21:04: PM2 error: Error caught while calling pidusage
PM2        | 2022-02-21T17:21:04: PM2 error: Error: Error: spawn wmic ENOENT
PM2        | 2022-02-21T17:21:34: PM2 error: Error caught while calling pidusage
PM2        | 2022-02-21T17:21:34: PM2 error: Error: Error: spawn wmic ENOENT
PM2        | 2022-02-21T17:22:04: PM2 error: Error caught while calling pidusage
PM2        | 2022-02-21T17:22:04: PM2 error: Error: Error: spawn wmic ENOENT
PM2        | 2022-02-21T17:22:34: PM2 error: Error caught while calling pidusage
PM2        | 2022-02-21T17:22:34: PM2 error: Error: Error: spawn wmic ENOENT
PM2        | 2022-02-21T17:23:04: PM2 error: Error caught while calling pidusage
PM2        | 2022-02-21T17:23:04: PM2 error: Error: Error: spawn wmic ENOENT
PM2        | 2022-02-21T17:23:34: PM2 error: Error caught while calling pidusage
PM2        | 2022-02-21T17:23:34: PM2 error: Error: Error: spawn wmic ENOENT
PM2        | 2022-02-21T17:23:40: PM2 error: Error caught while calling pidusage
PM2        | 2022-02-21T17:23:40: PM2 error: Error: Error: spawn wmic ENOENT

oplexz avatar Feb 21 '22 14:02 oplexz

I have been having this same issue, Any updates on how to fix this or at least not throw that many errors in my logs

jalmarverbraak avatar Nov 05 '24 10:11 jalmarverbraak

Windows 11 no longer has WMIC as it has been replaced by the WMI interface. You can enable it by following the instructions here but the real fix is that PM2 would have to move away from WMIC and use the WMI interface.

ccubed avatar Nov 27 '24 21:11 ccubed

Windows 11 no longer has WMIC as it has been replaced by the WMI interface. You can enable it by following the instructions here but the real fix is that PM2 would have to move away from WMIC and use the WMI interface.

This worked. Thanks for this!

jake-knerr avatar Jan 10 '25 16:01 jake-knerr

Windows 11 no longer has WMIC as it has been replaced by the WMI interface. You can enable it by following the instructions here but the real fix is that PM2 would have to move away from WMIC and use the WMI interface.

unfortunately i cannot modify windows features on my work laptop so i hope this gets fixed soon

EDIT: Looks like this might be a pidusage issue. And was fixed here https://github.com/soyuka/pidusage/pull/185 released as v4

adamk33n3r avatar May 07 '25 16:05 adamk33n3r