box2 icon indicating copy to clipboard operation
box2 copied to clipboard

Build task fail if there is other composer.json in home directory

Open konradpodgorski opened this issue 8 years ago • 1 comments

I had empty composer.json file in my home directory (created by mistake, not sure why it existed there)

this composer.json was loaded instead of one from project root directory, because it didn't include vendor-dir script pretty much fail with the following error.

Might be a good idea to limit searching in parent directories to the directory from where task is actually run. https://github.com/box-project/box2/blob/2.0/bin/box#L37-L49

$ ./vendor/bin/box build -v
PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'The Composer class loader "/Users/konrad/vendor/autoload.php" could not be found.' in /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box:89
Stack trace:
#0 /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box(16): loadComposerClassloader('/Users/konrad/p...')
#1 {main}
  thrown in /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box on line 89

Fatal error: Uncaught exception 'RuntimeException' with message 'The Composer class loader "/Users/konrad/vendor/autoload.php" could not be found.' in /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box:89
Stack trace:
#0 /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box(16): loadComposerClassloader('/Users/konrad/p...')
#1 {main}
  thrown in /Users/konrad/projects/acme-project/generator/vendor/kherge/box/bin/box on line 89

konradpodgorski avatar May 19 '16 09:05 konradpodgorski

I'm not sure how this would work for running Box from installations that are not in the current working directory path.

kherge avatar May 20 '16 01:05 kherge