box icon indicating copy to clipboard operation
box copied to clipboard

Unable to generate phar file using box 3.16.0 & composer version 2.2.0

Open narayanghimire opened this issue 2 years ago • 2 comments

Bug report

Question Answer
Box version 3.16.0@adb282a
PHP version 7.4
Composer version 2.2.0
Platform with version MacOS MacOs Monterey
When trying to compile with the latest 3.16.0 .phar Release, I get the error
php ./tools/box compile

require(/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box31208/vendor/amphp/amp/lib/functions.php): failed to open stream: No such file or directory

I am getting this error especially if I am using the composer 2.2.0 on my machine. Now If I will downgrade my composer version to 2.1.14 and try to generate phar file then there is no error & phar file will be created without any errors.

box.json.dist
{
  "main": "bin/console",
 "output": "dist/robo.phar",
 "dump-autoload": true
}
Output
> ---Starting Building  phar file---
[debug] Changed the memory limit from "128MB" to "512M"
[debug] Checking BOX_ALLOW_XDEBUG
[debug] phar.readonly is disabled
[debug] The Xdebug extension is not loaded

____
/ __ )____  _  __
/ __  / __ \| |/_/
/ /_/ / /_/ />  <
/_____/\____/_/|_|


Box version 3.16.0@adb282a 2022-02-13 23:54:13 UTC

// Loading the configuration file "/Users/Narayan/Desktop/test/development/box.json".

🔨  Building the PHAR "/Users/Narayan/Desktop/test/development/src/Build/robo.phar"

? No compactor to register
? Adding main file: /Users/Narayan/Desktop/test/development/src/Build/Bootstrap.php
? Adding requirements checker
? Adding binary files
> No file found
? Auto-discover files? Yes
? Exclude dev files? Yes
? Adding files
> 2504 file(s)
? Generating new stub
- Using shebang line: #!/usr/bin/env php
- Using banner:
> Generated by Humbug Box 3.16.0@adb282a.
>
> @link https://github.com/humbug/box
? Dumping the Composer autoloader
> '/usr/local/bin/composer' 'dump-autoload' '--classmap-authoritative' '--no-dev' '-vvv' '--ansi'

In ComposerOrchestrator.php line 172:

[RuntimeException]
Could not dump the autoloader.


Exception trace:
at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Composer/ComposerOrchestrator.php:172
KevinGH\Box\Composer\ComposerOrchestrator::dumpAutoloader() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Composer/ComposerOrchestrator.php:82
KevinGH\Box\Composer\ComposerOrchestrator::dumpAutoload() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Console/Command/Compile.php:577
KevinGH\Box\Console\Command\Compile::KevinGH\Box\Console\Command\{closure}() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Box.php:136
KevinGH\Box\Box->endBuffering() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Console/Command/Compile.php:583
KevinGH\Box\Console\Command\Compile->commit() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Console/Command/Compile.php:241
KevinGH\Box\Console\Command\Compile->createPhar() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Console/Command/Compile.php:200
KevinGH\Box\Console\Command\Compile->executeCommand() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Console/Command/BaseCommand.php:42
KevinGH\Box\Console\Command\BaseCommand->execute() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/vendor/symfony/console/Application.php:1015
Symfony\Component\Console\Application->doRunCommand() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/vendor/symfony/console/Application.php:299
Symfony\Component\Console\Application->doRun() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/bin/box:52
require() at /Users/Narayan/.phive/phars/humbug/box-3.16.0.phar:18

In ComposerOrchestrator.php line 175:

[Symfony\Component\Process\Exception\ProcessFailedException]
The command "'/usr/local/bin/composer' 'dump-autoload' '--classmap-authoritative' '--no-dev' '-vvv' '--ansi'" failed.

Exit Code: 1(General error)

Working directory: /private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404

Output:
================


Error Output:
================
Running 2.2.0 (2021-12-22 11:03:27) with PHP 7.4.28 on Darwin / 21.3.0
Reading ./composer.json (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404/composer.json)
Loading config file /Users/Narayan/.composer/auth.json
Loading config file ./composer.json (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404/composer.json)
Checked CA file /usr/local/etc/ca-certificates/cert.pem: valid
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): git branch -a --no-color --no-abbrev -v
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): git describe --exact-match --tags
Executing command (CWD): git --version
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): git log --pretty="%H" -n1 HEAD --no-show-signature
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): hg branch
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): fossil branch list
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): fossil tag list
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): svn info --xml
Reading /Users/Narayan/.composer/composer.json
Loading config file /Users/Narayan/.composer/auth.json
Loading config file /Users/Narayan/.composer/composer.json (/Users/Narayan/.composer/composer.json)
Loading config file /Users/Narayan/.composer/auth.json
Reading /Users/Narayan/.composer/auth.json
Reading /private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404/vendor/composer/installed.json
Reading /Users/Narayan/.composer/vendor/composer/installed.json
Reading ./composer.json (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404/composer.json)
Loading config file /Users/Narayan/.composer/auth.json
Loading config file ./composer.json (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404/composer.json)
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): git branch -a --no-color --no-abbrev -v
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): git describe --exact-match --tags
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): git log --pretty="%H" -n1 HEAD --no-show-signature
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): hg branch
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): fossil branch list
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): fossil tag list
Executing command (/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404): svn info --xml
Reading /Users/Narayan/.composer/composer.json
Loading config file /Users/Narayan/.composer/auth.json
Loading config file /Users/Narayan/.composer/composer.json (/Users/Narayan/.composer/composer.json)
Loading config file /Users/Narayan/.composer/auth.json
Reading /Users/Narayan/.composer/auth.json
Reading /private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404/vendor/composer/installed.json



[ErrorException]

require(/private/var/folders/lj/v149l1l55z18qv4nzfy3xhb80000gp/T/box/Box79404/vendor/amphp/amp/lib/functions.php): failed to open stream: No such file or dir
ectory



Exception trace:
() at phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:1422
Composer\Util\ErrorHandler::handle() at phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:1422
require() at phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:1422
Composer\Autoload\composerRequire() at phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php:249
Composer\Plugin\PluginManager->registerPackage() at phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php:474
Composer\Plugin\PluginManager->loadRepository() at phar:///usr/local/bin/composer/src/Composer/Plugin/PluginManager.php:102
Composer\Plugin\PluginManager->loadInstalledPlugins() at phar:///usr/local/bin/composer/src/Composer/Factory.php:439
Composer\Factory->createComposer() at phar:///usr/local/bin/composer/src/Composer/Factory.php:643
Composer\Factory::create() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:444
Composer\Console\Application->getComposer() at phar:///usr/local/bin/composer/src/Composer/Command/BaseCommand.php:65
Composer\Command\BaseCommand->getComposer() at phar:///usr/local/bin/composer/src/Composer/Command/BaseCommand.php:150
Composer\Command\BaseCommand->initialize() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:211
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:835
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:185
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:335
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:130
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:73
require() at /usr/local/bin/composer:29

dump-autoload [-o|--optimize] [-a|--classmap-authoritative] [--apcu] [--apcu-prefix APCU-PREFIX] [--dev] [--no-dev] [--ignore-platform-req IGNORE-PLATFORM-REQ] [-
-ignore-platform-reqs]


Exception trace:
at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Composer/ComposerOrchestrator.php:175
KevinGH\Box\Composer\ComposerOrchestrator::dumpAutoloader() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Composer/ComposerOrchestrator.php:82
KevinGH\Box\Composer\ComposerOrchestrator::dumpAutoload() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Console/Command/Compile.php:577
KevinGH\Box\Console\Command\Compile::KevinGH\Box\Console\Command\{closure}() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Box.php:136
KevinGH\Box\Box->endBuffering() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Console/Command/Compile.php:583
KevinGH\Box\Console\Command\Compile->commit() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Console/Command/Compile.php:241
KevinGH\Box\Console\Command\Compile->createPhar() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Console/Command/Compile.php:200
KevinGH\Box\Console\Command\Compile->executeCommand() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/src/Console/Command/BaseCommand.php:42
KevinGH\Box\Console\Command\BaseCommand->execute() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/vendor/symfony/console/Application.php:1015
Symfony\Component\Console\Application->doRunCommand() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/vendor/symfony/console/Application.php:299
Symfony\Component\Console\Application->doRun() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at phar:///Users/Narayan/.phive/phars/humbug/box-3.16.0.phar/bin/box:52
require() at /Users/Narayan/.phive/phars/humbug/box-3.16.0.phar:18

compile [-c|--config CONFIG] [--debug] [--no-parallel] [--no-restart] [--dev] [--no-config] [--with-docker] [-d|--working-dir WORKING-DIR]

narayanghimire avatar Mar 01 '22 13:03 narayanghimire

Could you please try with the --debug option and publish the new stack trace as well as the generated .box_dump/.box_configuration file?

theofidry avatar Mar 01 '22 20:03 theofidry

@theofidry Thanks for your quick reply.

Please check my above description of output, it is now changed with the new stack trace.

This is my box configuration file :box_configuration.txt

narayanghimire avatar Mar 02 '22 08:03 narayanghimire

This should have been fixed by now. If you still encounter this issue please feel free to open a new issue for it.

theofidry avatar Nov 27 '23 09:11 theofidry

yes, it is now fixed. Thanks for the update again

narayanghimire avatar Nov 27 '23 09:11 narayanghimire