lorisleiva/laravel-docker

phpcs: command not found

Closed this issue ยท 8 comments

Hi,
I'm having an issue with the latest image
The phpcs command isn't recognized anymore

I first thought it came from the removal of the composer path from $PATH env, but after to change my script in several ways it doesn't seems to be the case.

Here is what I tried so far

$ php /composer/vendor/bin/phpcs --exclude=Generic.Files.LineLength --extensions=php app
Could not open input file: /composer/vendor/bin/phpcs

$ php vendor/bin/phpcs --exclude=Generic.Files.LineLength --extensions=php app
Could not open input file: vendor/bin/phpcs

$ /composer/vendor/bin/phpcs --exclude=Generic.Files.LineLength --extensions=php app
/bin/bash: line 123: /composer/vendor/bin/phpcs: No such file or directory

$ ./vendor/bin/phpcs --exclude=Generic.Files.LineLength --extensions=php app
/bin/bash: line 123: ./vendor/bin/phpcs: No such file or directory

phpcs --exclude=Generic.Files.LineLength --extensions=php app
Used to work several days ago

Hi there ๐Ÿ‘‹

Thanks for raising this. Since a recent change, this package is relying on this repository to install composer but it seems like it's not installing it in the same location as we were before so I'll investigate this.

I've just checked and it's installing it under /usr/local/bin I'll add it to the PATH variable and see if this fix this issue.

I've just checked and it's installing it under /usr/local/bin I'll add it to the PATH variable and see if this fix this issue.

Didn't seem to work for me, GitLab CI reports the following, hash from image is the same as the last build from your commit: https://github.com/lorisleiva/laravel-docker/runs/4434803140

image

I've been able to fix the issue on my pipeline by getting the global bin directory from this commande composer global config bin-dir --absolute which output /root/.composer/vendor/bin then changed the phpcs command line to

$ /root/.composer/vendor/bin/phpcs --exclude=Generic.Files.LineLength --extensions=php app

Ah thanks for that! I've pushed a new commit that adds that folder into the $PATH variable. Hopefully, once the images are built and deployed, you should be able to use phpcs directly. ๐Ÿ‘Œ

could you please let us know how to reset the gitlab to use the latest image?

Hmm it should be live now so it should work automatically. Do you still get the same error? If so can you check your global composer directory for me to make sure it's the same as the one above?

Can confirm it has been fixed. Shared runners on GitLab use the new image and phpcs is in the PATH