Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: spawn wmic.exe ENOENT on Windows Server 2025 #69

Open
MikeMcC399 opened this issue Dec 19, 2024 · 4 comments
Open

Error: spawn wmic.exe ENOENT on Windows Server 2025 #69

MikeMcC399 opened this issue Dec 19, 2024 · 4 comments

Comments

@MikeMcC399
Copy link
Contributor

ps-tree has a dependency on the deprecated Windows Management Instrumentation command-line (WMIC) utility

Issue

ps-tree fails under GitHub Actions windows-2025 with the error

Error: spawn wmic.exe ENOENT

ps-tree depends on wmic.

For Microsoft Windows Servers, wmic has been deprecated since 2016 and it is not installed by default on Windows Server 2025 (see Features we're no longer developing).

The GitHub Actions runner image windows-2025, currently in beta status, does not include WMIC. (See Windows Server 2025 is now in public preview).

Steps to reproduce

Run the following workflow in this repo in GitHub Actions

name: ci-test
on: [push, pull_request, workflow_dispatch]

jobs:

  ps-tree-ci:
    strategy:
      fail-fast: false
      matrix:
        node: [22]
        os: [windows-2025]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}
      - run: node -v
      - run: npm -v
      - name: Checkout
        uses: actions/checkout@v4
      - run: npm ci
      - run: npm test
      - run: npm run coverage

Logs

Run npm test

> [email protected] test
> istanbul cover node_modules/tape/bin/tape test/test.js

TAP version 13
# Spawn a Parent process which has ten Child processes
=============================================================================
Writing coverage object [D:\a\ps-tree\ps-tree\coverage\coverage.json]
Writing coverage reports at [D:\a\ps-tree\ps-tree\coverage]
=============================================================================

=============================== Coverage summary ===============================
Statements   : 27.5% ( 11/40 )
Branches     : 16.67% ( 3/18 )
Functions    : 20% ( 1/5 )
Lines        : 27.5% ( 11/40 )
================================================================================
node:events:502
      throw er; // Unhandled 'error' event
      ^

Error: spawn wmic.exe ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn wmic.exe',
  path: 'wmic.exe',
  spawnargs: [ 'PROCESS', 'GET', 'Name,ProcessId,ParentProcessId,Status' ]
}

Node.js v22.12.0
Error: Process completed with exit code 1.
@colin969
Copy link

colin969 commented Dec 21, 2024

wmic was deprecated a while ago, it's been completely removed from the latest Windows update. This issue will already present itself on regular users machines.

@MikeMcC399
Copy link
Contributor Author

@colin969

wmic was deprecated a while ago, it's been completely removed from the latest Windows update. This issue will already present itself on regular users machines.

@colin969
Copy link

Yes, my comments would refer to 24H2.

Admittedly not sure why they're separate issues when they're the exact same problem though, the removal of wmic.exe.

@MikeMcC399
Copy link
Contributor Author

@colin969

Yes, my comments would refer to 24H2.

Admittedly not sure why they're separate issues when they're the exact same problem though, the removal of wmic.exe.

The underlying issue is the same across Windows desktop and Windows Server operating systems, and the separate GitHub issues could be combined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants