Friday, October 7, 2022

[SOLVED] phpspec in vagrant vm - permissions error

Issue

I am setting up a new Laravel project and wishing to use PHPSpec within the project.

I can run PHPSPec from my local OSX machine, but I want to be able to run it from within the VM. I get "command not found" or "Permission denied" errors when running from within the Vagrant VM (Ubuntu 12 currently). This seems to be because the files are not executable in the VM, and chmod +x makes no difference.

I have the following in my Vagrantfile:

config.vm.synced_folder "./" , "/var/www/" + project_name + "/", :mount_options => ["dmode=777", "fmode=666"]

This is partly so that I can give the VM to colleagues once its all set up, without them having to set things up locally. Also feels better to run all dev related tasks from the VM. Opinions may differ on this..

Any help much appreciated. Thank you in advance!


Solution

I solved this by changing the line in the Vagrantfile to:

config.vm.synced_folder "./" , "/var/www/" + project_name + "/", :nfs => true

':nfs => true' being the important bit



Answered By - Adamski
Answer Checked By - Gilberto Lyons (WPSolving Admin)