Question: Question:
I'm using Laravel v5.1.4.
When I create a project using Laravel installer v1.2.1, phpunit fails with "Permission denied" as shown below. What should I do?
$ laravel -V
Laravel Installer version 1.2.1
$ laravel new project
$ cd project
$ phpunit
-bash: ./vendor/bin/phpunit: Permission denied
If you check the permissions, you do not have execute permission.
$ ls -l ./vendor/bin
total 24
-rw-r--r-- 1 user staff 750 7 2 13:51 phpspec
-rw-r--r-- 1 user staff 930 7 2 13:51 phpunit
-rw-r--r-- 1 user staff 3296 7 2 13:51 psysh
I added execute permission and tried phpunit, but I got a new error …
$ chmod +x ./vendor/bin/phpunit
$ ls -l ./vendor/bin
total 24
-rw-r--r-- 1 user staff 750 7 2 13:51 phpspec
-rwxr-xr-x 1 user staff 930 7 2 13:51 phpunit
-rw-r--r-- 1 user staff 3296 7 2 13:51 psysh
$ phpunit
You need to set up the project dependencies using the following commands:
wget http://getcomposer.org/composer.phar
php composer.phar install
By the way, phpunit does not cause an error when creating a project via composer.
Answer: Answer:
This is due to a bug in the installer.
It occurs when you create a project with laravel new
as follows.
Since it is written in the manual, I think that I use this command normally, but there is a bug.
larval new [project]
You can recover by deleting the following directories and executing composer install
.
vendor/bin
vendor/classpreloader
vendor/phpspec
vendor/phpunit
vendor/psy
Alternatively, it may take some time, but you can also recover by deleting the entire vendor
directory and then composer install
. This is easy because you don't have to specify the directory in detail.
To avoid this bug, create a project using composer
instead of the installer.
composer create-project laravel/laravel --prefer-dist [project]
■ Reference
https://laracasts.com/discuss/channels/general-discussion/gulp-tdd-phpunit-permission-denied
https://laracasts.com/index.php/discuss/channels/general-discussion/phpunit-woes
* The above site is information from 4 months ago. There is a composer update
in the recovery procedure, but now it is an error, so composer install
is the correct answer.
■ Issues
https://github.com/laravel/installer/pull/26
https://github.com/laravel/framework/issues/9051
https://github.com/laravel/framework/issues/9491
It's been left unattended for two months after the bug was definitely communicated to the developers.
The first isuue report is easily closed without explanation.