richdynamix / magestead

The Vagrant Solution for Magento Developers
81 stars 29 forks source link

auth.json faied to open stream #85

Closed t1gor closed 7 years ago

t1gor commented 7 years ago

Hi.

First of all - thanks for coming up with a great tool!

I've been trying to install and start using the one, but I get the following error:

PHP Warning:  file_put_contents([vendor-dir] vendor (/home/igort/PhpstormProjects/vendor)
[bin-dir] {$vendor-dir}/bin (/home/igort/PhpstormProjects/vendor/bin)
[cache-dir] /home/igort/.composer/cache
[data-dir] /home/igort/.composer
[cache-files-dir] {$cache-dir}/files (/home/igort/.composer/cache/files)
[cache-repo-dir] {$cache-dir}/repo (/home/igort/.composer/cache/repo)
[cache-vcs-dir] {$cache-dir}/vcs (/home/igort/.composer/cache/vcs)
/home/igort/.composer/auth.json): failed to open stream: No such file or directory in /home/igort/.composer/vendor/richdynamix/magestead/src/Magestead/Helper/Options.php on line 201
PHP Stack trace:
PHP   1. {main}() /home/igort/.composer/vendor/richdynamix/magestead/magestead:0
PHP   2. Symfony\Component\Console\Application->run() /home/igort/.composer/vendor/richdynamix/magestead/magestead:66
PHP   3. Symfony\Component\Console\Application->doRun() /home/igort/.composer/vendor/symfony/console/Application.php:120
PHP   4. Symfony\Component\Console\Application->doRunCommand() /home/igort/.composer/vendor/symfony/console/Application.php:189
PHP   5. Symfony\Component\Console\Command\Command->run() /home/igort/.composer/vendor/symfony/console/Application.php:826
PHP   6. Magestead\Command\NewCommand->execute() /home/igort/.composer/vendor/symfony/console/Command/Command.php:262
PHP   7. Magestead\Helper\Options->__construct() /home/igort/.composer/vendor/richdynamix/magestead/src/Magestead/Command/NewCommand.php:47
PHP   8. Magestead\Helper\Options->setMagento2Settings() /home/igort/.composer/vendor/richdynamix/magestead/src/Magestead/Helper/Options.php:47
PHP   9. Magestead\Helper\Options->verifyAuth() /home/igort/.composer/vendor/richdynamix/magestead/src/Magestead/Helper/Options.php:133
PHP  10. file_put_contents() /home/igort/.composer/vendor/richdynamix/magestead/src/Magestead/Helper/Options.php:201

And the thing is:

➜  PhpstormProjects ls -la /home/igort/.composer/auth.json 
-rw------- 1 igort igort 124 Jan 24 13:07 /home/igort/.composer/auth.json

It's not writable. Which brings us to the following line:

https://github.com/richdynamix/magestead/blob/develop/src/Magestead/Helper/Options.php#L201

I guess I could submit a pull request to throw an exception and terminate on this step with the instructions on how to change permissions or add content manually.

t1gor commented 7 years ago

exception-magestead

Something like this

t1gor commented 7 years ago

Seems like the issue was different. When trying to locate composer home dir, the output of composer config --list --global was containing the home in all the path:

composer config --list --global | grep "\[home\]" 
[home] /home/igort/.composer
➜  .composer composer config --list --global | grep home       
[vendor-dir] vendor (/home/igort/.composer/vendor)
[bin-dir] {$vendor-dir}/bin (/home/igort/.composer/vendor/bin)
[cache-dir] /home/igort/.composer/cache
[data-dir] /home/igort/.composer
[cache-files-dir] {$cache-dir}/files (/home/igort/.composer/cache/files)
[cache-repo-dir] {$cache-dir}/repo (/home/igort/.composer/cache/repo)
[cache-vcs-dir] {$cache-dir}/vcs (/home/igort/.composer/cache/vcs)
[home] /home/igort/.composer

Which is why the command could not access the directory correctly. Sending another pull request now.