nunomaduro/phpinsights

wmic is not recognized as an internal or external command on a clean install of Windows 11 24H2

Open

#696 aperta il 12 ott 2024

Vedi su GitHub
 (3 commenti) (0 reazioni) (0 assegnatari)PHP (308 fork)batch import
bughelp wanted

Metriche repository

Star
 (5092 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

Q A
Bug report? yes
Feature request? no
Library version 2.11.0 who is reporting itself as 2.10
PHP version 8.3.10
Windows version 24H2 clean install (no upgrade)

I've installed my computer with a clean install of the most recent Windows 24H2 installation media. The error I've got is:

phpinsights analyse --no-interaction --ansi 'wmic' is not recognized as an internal or external command, operable program or batch file. 'wmic' is not recognized as an internal or external command, operable program or batch file. 'wmic' is not recognized as an internal or external command, operable program or batch file. 'wmic' is not recognized as an internal or external command, operable program or batch file. 'wmic' is not recognized as an internal or external command, operable program or batch file.

Fatal error: Uncaught DivisionByZeroError: Division by zero in C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Runner.php:115 Stack trace: #0 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Insights\InsightFactory.php(98): NunoMaduro\PhpInsights\Domain\Runner->run() #1 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Insights\InsightFactory.php(69): NunoMaduro\PhpInsights\Domain\Insights\InsightFactory->runInsightCollector() #2 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Insights\InsightCollectionFactory.php(67): NunoMaduro\PhpInsights\Domain\Insights\InsightFactory->makeFrom() #3 [internal function]: NunoMaduro\PhpInsights\Domain\Insights\InsightCollectionFactory::NunoMaduro\PhpInsights\Domain\Insights{closure}() #4 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Insights\InsightCollectionFactory.php(66): array_map() #5 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Application\Console\Analyser.php(36): NunoMaduro\PhpInsights\Domain\Insights\InsightCollectionFactory->get() #6 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Application\Console\Commands\AnalyseCommand.php(65): NunoMaduro\PhpInsights\Application\Console\Analyser->analyse() #7 [internal function]: NunoMaduro\PhpInsights\Application\Console\Commands\AnalyseCommand->__invoke() #8 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Application\Console\Commands\InvokableCommand.php(41): call_user_func()
#9 C:\WAMP\APPS\php-qa\vendor\symfony\console\Command\Command.php(279): NunoMaduro\PhpInsights\Application\Console\Commands\InvokableCommand->execute() #10 C:\WAMP\APPS\php-qa\vendor\symfony\console\Application.php(1029): Symfony\Component\Console\Command\Command->run() #11 C:\WAMP\APPS\php-qa\vendor\symfony\console\Application.php(316): Symfony\Component\Console\Application->doRunCommand() #12 C:\WAMP\APPS\php-qa\vendor\symfony\console\Application.php(167): Symfony\Component\Console\Application->doRun() #13 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\bin\phpinsights(42): Symfony\Component\Console\Application->run() #14 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\bin\phpinsights(43): {closure}() #15 C:\WAMP\APPS\php-qa\vendor\bin\phpinsights(119): include('...') #16 {main} thrown in C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Runner.php on line 115 PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Runner.php:115 Stack trace: #0 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Insights\InsightFactory.php(98): NunoMaduro\PhpInsights\Domain\Runner->run() #1 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Insights\InsightFactory.php(69): NunoMaduro\PhpInsights\Domain\Insights\InsightFactory->runInsightCollector() #2 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Insights\InsightCollectionFactory.php(67): NunoMaduro\PhpInsights\Domain\Insights\InsightFactory->makeFrom() #3 [internal function]: NunoMaduro\PhpInsights\Domain\Insights\InsightCollectionFactory::NunoMaduro\PhpInsights\Domain\Insights{closure}() #4 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Insights\InsightCollectionFactory.php(66): array_map() #5 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Application\Console\Analyser.php(36): NunoMaduro\PhpInsights\Domain\Insights\InsightCollectionFactory->get() #6 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Application\Console\Commands\AnalyseCommand.php(65): NunoMaduro\PhpInsights\Application\Console\Analyser->analyse() #7 [internal function]: NunoMaduro\PhpInsights\Application\Console\Commands\AnalyseCommand->__invoke() #8 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Application\Console\Commands\InvokableCommand.php(41): call_user_func()
#9 C:\WAMP\APPS\php-qa\vendor\symfony\console\Command\Command.php(279): NunoMaduro\PhpInsights\Application\Console\Commands\InvokableCommand->execute() #10 C:\WAMP\APPS\php-qa\vendor\symfony\console\Application.php(1029): Symfony\Component\Console\Command\Command->run() #11 C:\WAMP\APPS\php-qa\vendor\symfony\console\Application.php(316): Symfony\Component\Console\Application->doRunCommand() #12 C:\WAMP\APPS\php-qa\vendor\symfony\console\Application.php(167): Symfony\Component\Console\Application->doRun() #13 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\bin\phpinsights(42): Symfony\Component\Console\Application->run() #14 C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\bin\phpinsights(43): {closure}() #15 C:\WAMP\APPS\php-qa\vendor\bin\phpinsights(119): include('...') #16 {main} thrown in C:\WAMP\APPS\php-qa\vendor\nunomaduro\phpinsights\src\Domain\Runner.php on line 115 Script phpinsights analyse --no-interaction --ansi handling the phpinsights event returned with error code 255

Starting from Windows 24H2 the wmic command will not be installed by default. https://techcommunity.microsoft.com/t5/windows-it-pro-blog/wmi-command-line-wmic-utility-deprecation-next-steps/ba-p/4039242 . As a workaround I could install the feature manually https://techcommunity.microsoft.com/t5/windows-it-pro-blog/how-to-install-wmic-feature-on-demand-on-windows-11/ba-p/4189530 but this is not a future proof solution.

Can you replace the wmic command by another method or library?

Guida contributor