laravel-zero / laravel-zero

A PHP framework for console artisans

Home Page:https://laravel-zero.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

app:build ErrorException rename(app.phar, builds/app): the system cannot find the file specified (code 2)

underdpt opened this issue · comments

Hi,

I'm building a updated app (from Laravel-zero 8 to 10) on windows and I'm finding the next error.

                                                
                Building process                
                                                

 Build version? [unreleased]:
 >

   1. Moving application to production mode: ✔

   2. Compile into a single file: ✔

[2023-09-09 08:34:55] development.ERROR: rename(D:\desarrollos\gasNoroeste\siniestros\siniestros.phar,D:\desarrollos\gasNoroeste\siniestros\builds\siniestros): El sistema no puede encontrar el archivo especificado (code: 2
) {"exception":"[object] (ErrorException(code: 0): rename(D:\\desarrollos\\gasNoroeste\\siniestros\\siniestros.phar,D:\\desarrollos\\gasNoroeste\\siniestros\\builds\\siniestros): El sistema no puede encontrar el archivo especificado (code: 2) at D:\\desarrollos\\gasNoroeste\\siniestros\\vendor\\illuminate\\filesystem\\Filesystem.php:330)

Building with extra verbosity, the error seems to be in box:

 [ERROR] The configuration file is invalid.                                                                             



In Assert.php line 1012:                                                                                                                                                                                                      
                                                                                                                                                                                                                              
  [_HumbugBoxb47773b41c19\Webmozart\Assert\InvalidArgumentException]                                                                                                                                                          
  The compactor class "Herrera\Box\Compactor\Php" does not exist.                                                                                                                                                             
                                                                                                                                                                                                                              
                                                                                                                                                                                                                              
Exception trace:                                                                                                                                                                                                              
  at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/webmozart/assert/src/Assert.php:1012                                                                                           
 _HumbugBoxb47773b41c19\Webmozart\Assert\Assert::reportInvalidArgument() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/webmozart/assert/src/Assert.php:726                     
 _HumbugBoxb47773b41c19\Webmozart\Assert\Assert::classExists() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/humbug/php-scoper/vendor-hotfix/Configuration.php:788             
 _HumbugBoxb47773b41c19\KevinGH\Box\Configuration\Configuration::_HumbugBoxb47773b41c19\KevinGH\Box\Configuration\{closure}() at n/a:n/a                                                                                      
 array_map() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/humbug/php-scoper/vendor-hotfix/Configuration.php:787                                                               
 _HumbugBoxb47773b41c19\KevinGH\Box\Configuration\Configuration::createCompactors() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/humbug/php-scoper/vendor-hotfix/Configuration.php:781                                                                                                                                                                                                                      
 _HumbugBoxb47773b41c19\KevinGH\Box\Configuration\Configuration::retrieveCompactors() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/humbug/php-scoper/vendor-hotfix/Configuration.php:186                                                                                                                                                                                                                    
 _HumbugBoxb47773b41c19\KevinGH\Box\Configuration\Configuration::create() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/src/Configuration/ConfigurationLoader.php:21                  
 _HumbugBoxb47773b41c19\KevinGH\Box\Configuration\ConfigurationLoader->loadFile() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/src/Console/ConfigurationLoader.php:22                
 _HumbugBoxb47773b41c19\KevinGH\Box\Console\ConfigurationLoader::getConfig() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/src/Console/Command/ConfigOption.php:22                    
 _HumbugBoxb47773b41c19\KevinGH\Box\Console\Command\ConfigOption::getConfig() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/src/Console/Command/Compile.php:111                       
 _HumbugBoxb47773b41c19\KevinGH\Box\Console\Command\Compile->execute() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/fidry/console/src/Command/SymfonyCommand.php:61           
 _HumbugBoxb47773b41c19\Fidry\Console\Command\SymfonyCommand->execute() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/symfony/console/Command/Command.php:164                  
 _HumbugBoxb47773b41c19\Symfony\Component\Console\Command\Command->run() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/symfony/console/Application.php:675                     
 _HumbugBoxb47773b41c19\Symfony\Component\Console\Application->doRunCommand() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/symfony/console/Application.php:218                
 _HumbugBoxb47773b41c19\Symfony\Component\Console\Application->doRun() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/symfony/console/Application.php:124                       
 _HumbugBoxb47773b41c19\Symfony\Component\Console\Application->run() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/vendor/fidry/console/src/Application/ApplicationRunner.php:34      
 _HumbugBoxb47773b41c19\Fidry\Console\Application\ApplicationRunner->run() at phar://D:/desarrollos/gasNoroeste/siniestros/vendor/laravel-zero/framework/bin/box/bin/box:46                                                   
 require() at D:\desarrollos\gasNoroeste\siniestros\vendor\laravel-zero\framework\bin\box:18                                                                                                                                  
                                                                                                                                                                                                                              
compile [--debug] [--no-parallel] [--no-restart] [--dev] [--no-config] [--with-docker] [-c|--config CONFIG] [-d|--working-dir WORKING-DIR]                                                                                    
                                                                                                                                                                                                                              
                                                                                                                                                                                                                              
[debug] Restarted process exited 1

After some researching, it seems that the compactors on box.json were renamed on box 4.0, from

    "compactors": [
        "Herrera\\Box\\Compactor\\Php",
        "Herrera\\Box\\Compactor\\Json"
    ]

to:

    "compactors": [
        "KevinGH\\Box\\Compactor\\Php",
        "KevinGH\\Box\\Compactor\\Json"
    ]

I think box was updated to 4.0 on Laravel-Zero 10. I think this change should be on the Upgrading guide

This change was made back in 2017, and has been in Box since v3.0.0-RC.3

Box 4.0 did remove support for the aliases for legacy compactors. I'll add a note to the upgrade guide. 👍🏻

I guess I've been an early adopter for Laravel-Zero :-)

Just added a note, thanks for bringing this up. 👍🏻