Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.59k stars 2.62k forks source link

Windows 11: Error: spawn wmic ENOENT #5311

Open oplexz opened 2 years ago

oplexz commented 2 years ago

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
    }]
    }
  2. 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
jalmarverbraak commented 2 weeks ago

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