Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ionut's avatar

Gulp TDD - PHPUnit Permission Denied

Hi everyone,

I just installed my first Laravel 5 app.

I'm trying to play with it a bit, but when I run gulp I get the following error:

vagrant@homestead:~/Code/laravel5$ gulp
[20:37:26] Using gulpfile ~/Code/laravel5/gulpfile.js
[20:37:26] Starting 'default'...
[20:37:26] Starting 'phpunit'...
[20:37:31] Finished 'default' after 4.69 s
[20:37:31]

   *** Debug Cmd: ./vendor/bin/phpunit --colors --debug ***

[20:37:31] /bin/sh: 1: ./vendor/bin/phpunit: Permission denied

[20:37:31] { [Error: Command failed: /bin/sh: 1: ./vendor/bin/phpunit: Permission               denied
] killed: false, code: 126, signal: null }
[20:37:31] gulp-notify: [Red!]
[20:37:31] Finished 'phpunit' after 4.8 s
[20:37:31] gulp-notify: [Error running notifier] Could not send message: not found: notify-send

Anyone has any idea why?

Thank you

OF course I'm running it on Homestead

0 likes
17 replies
theflyingwhale's avatar

Hi lonut,

Seems like the permissions in /vendor/bin/phpunit are not correct, the phpunit file is not executable.

I suggest changing the permissions by running the following from inside the vendor folder:

chmod 766 bin -R

This should give the owner which is the vagrant user execute permissions.

WARNING: I did this myself and I am now getting the following error from phpunit when running gulp

Error: Command failed: You need to set up the project dependencies using the following commands: wget http://getcomposer.org/composer.phar php composer.phar install

theflyingwhale's avatar
Level 1

Alright I found a solution,

I created my project with the laravel installer by running --> laravel new [project] . Looks like it does not set the permissions correctly when you do this. So the solution is to install laravel using composer. composer create-project laravel/laravel.

But if you want to avoid doing a fresh install you can do the following:

Delete these folders

vendor/bin vendor/classpreloader vendor/phpspec vendor/phpunit vendor/psy

Then run composer update and everything should be peachy.

You can also read a bit about it here --> https://laracasts.com/index.php/discuss/channels/general-discussion/phpunit-woes since it is were i got most of this information.

22 likes
tosinoginni's avatar

Thanks theflyingwhale, you just saved me from time wasting

Mrmarty's avatar

Thank you @theflyingwhale ! It works now, but next time i will use composer again to install. Apparently this is still an issue.

bmitch's avatar

Ran into this as well. Ended up going with the composer create-project laravel/laravel command and that worked.

cyprusglobe's avatar

looks like this is still not fixed, ran into this just awhile ago.

wingsline's avatar

What I did is, I deleted the vendor directory and run a composer install.

emo1's avatar

not sure if it's very clean, but this worked for me

in Homestead/scripts/homestead.rb add "dmode=775","fmode=764" to the mount_opts array

Please or to participate in this conversation.