box-project / box

📦🚀 Fast, zero config application bundler with PHARs.
https://box-project.github.io/box
MIT License
1.12k stars 101 forks source link

Could not scan for classes inside "[...]vendor/humbug/php-scoper/vendor-hotfix/" which does not appear to be a file nor a folder #1285

Closed luanfreitasdev closed 9 months ago

luanfreitasdev commented 9 months ago

Bug report

Question Answer
Box version 4.6.0
PHP version 8.1, 8.2.13, 8.3
Platform with version MacOS Sonoma 4.2, Ubuntu
Github Repo https://github.com/laradumps/global-laradumps/actions/runs/7232435271/job/19706629841

Above version 4.0 this error occurs

composer.json

{
    "require": {
        "laradumps/laradumps-core": "^1.0"
    },
    "require-dev": {
        "humbug/box": "^3.15|^4.0"
    },
    "scripts": {
        "clear": "composer clearcache",
        "build": "clear && vendor/bin/box compile --no-parallel"
    }
}

Run:

cd phar-generator && composer install && composer build
box.json.dist ```json { } ```
Output ```bash $ command Box version 4.6.0@95b0d8e // Loading the configuration file "/Users/luan.freitas/Documents/laradumps/global/phar-generator/box.json". 🔨 Building the PHAR "/Users/luan.freitas/Documents/laradumps/global/phar-generator/laradumps.phar" ? Checking Composer compatibility > Supported version detected ? Registering compactors + KevinGH\Box\Compactor\PhpScoper ? Adding main file: /Users/luan.freitas/Documents/laradumps/global/phar-generator/index.php ? Skip requirements checker ? Adding binary files > No file found ? Auto-discover files? Yes ? Exclude dev files? Yes ? Adding files > 4076 file(s) ? Generating new stub - No shebang line - Using banner: > Generated by Humbug Box 4.6.0@95b0d8e. > > @link https://github.com/humbug/box ? Dumping the Composer autoloader In ComposerOrchestrator.php line 162: Could not dump the autoloader. In ComposerOrchestrator.php line 165: The command "'/opt/homebrew/bin/composer' 'dump-autoload' '--classmap-authoritative' '--no-dev' '--ansi'" failed. Exit Code: 1(General error) Working directory: /private/var/folders/34/fszzk_0s12g5_mwkw_gx1_pw0000gp/T/box/Box21151 Output: ================ Generating optimized autoload files (authoritative) Error Output: ================ In ClassMapGenerator.php line 129: Could not scan for classes inside "/private/var/folders/34/fszzk_0s12g5_mwkw_gx1_pw0000gp/T/box/Box21151/vendor/humbug/php-scoper/vendor-hotfix/" which does not appear to be a file nor a folder dump-autoload [-o|--optimize] [-a|--classmap-authoritative] [--apcu] [--apcu-prefix APCU-PREFIX] [--dry-run] [--dev] [--no-dev] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--strict-psr] compile [--debug] [--no-parallel] [--no-restart] [--dev] [--no-config] [--with-docker] [--composer-bin COMPOSER-BIN] [--allow-composer-check-failure] [-c|--config CONFIG] [-d|--working-dir WORKING-DIR] Script clear && vendor/bin/box compile --no-parallel handling the build event returned with error code 1 ```
theofidry commented 9 months ago

The issue probably stems from using it as a dependency: https://github.com/box-project/box/blob/7feeb4e0497f30ff1281637e3f79b1f179b74ebf/doc/faq.md#building-a-phar-with-box-as-a-dependency

luanfreitasdev commented 9 months ago

Thank you @theofidry! Works