Search code examples
laravelcomposer-phplaravel-5laravel-artisanartisan-migrate

Laravel 5 php artisan not running in Vagrant, missing vendor/services.json?


Randomly I cannot run php artisan on a project via Vagrant SSH. It works outside of Vegrant SSH (regular terminal session). I am receiving the following error:

[ErrorException]                                                                                      
  file_put_contents(/home/vagrant/cvahimt/vendor/services.json): failed to open stream: Protocol error 

I have tried everything I can think of - php artisan clear-compiled, composer dump-autoload, and removing vendor and running composer install again.

I noticed that services.json exists in my production environment but is absent locally. I cannot create it because vendor is read-only.

Also, when running composer update (with or without sudo) I receive this error:

[ErrorException]                                                                                                                  
  file_put_contents(/home/vagrant/cvahimt/vendor/composer/autoload_namespaces.php): failed to open stream: Operation not permitted  

Kind of a problem, I need to run php artisan migrate and that only works via Vagrant.


Solution

    1. change permissions on vendor folder chmod -R 777 vendor

    2. run a php artisan serve and stop, this will create the services.json file.