1. In the CI/CD Pipelines of GitLab, the build composer fails. as shown in Figure 1

$ php artisan key:generate
In DatabaseServiceProvider.php line 88:
Class 'Faker\Factory' not found
Cleaning up file based variables
ERROR: Job failed: command terminated with exit code 1
2. Search the class in the local environmentFaker\Factory, to confirm that /vendor/fzaninotto/faker/src/faker/factory.php exists. Execute in the local environment: php artisan key:generate succeeds. as shown in Figure 2

PS E:\wwwroot\object> php artisan key:generate
Application key set successfully.
3. Check the log in gitlab-runner, if[ ! -x “vendor” ];then echoVendor not exists; composer self-update 2.1.14; composer install –prefer-dist –no-ansi –no-interaction –no-progress –no-scripts –no-dev; else echovendor exists; fi. as shown in Figure 3

$ if [ ! -x "vendor" ];then echo 'vendor not exists'; composer self-update 2.1.14; composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts --no-dev; else echo 'vendor exists'; fi
vendor not exists
You are already using the latest available Composer version 2.1.14 (stable channel).
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 233 installs, 0 updates, 0 removals
4. Execute composer install –prefer-dist –no-ansi –no-interaction –no-progress –no-scripts –no-dev in the local environment, and then execute php artisan key:generate. Error: in application.php line 679: classBarryVDH\DebugBar\ServiceProvidernot found. The reason should be that there is a difference between the configuration items of the local environment and the online environment.
PS E:\wwwroot\object> php artisan key:generate
In Application.php line 679:
Class 'Barryvdh\Debugbar\ServiceProvider' not found
5. Execute composer install –prefer-dist –no-ansi –no-interaction –no-progress –no-scripts in the local environment, and then execute php artisan key:generate. No more errors. The reason for this confirmation is that the addition of –no-dev caused the pipeline failure. –no-dev: Skip the packages listed in the require-dev field. In the composer.json’s require-dev configuration, “fzaninotto/faker”: “^1.4” exists.
"require-dev": {
"fzaninotto/faker": "^1.4",
},
6. Move “fzaninotto/faker”: “^1.4” in the require-dev configuration to the require configuration. No more errors.
Need long-term technical maintenance or remote troubleshooting?
I am a PHP / Go backend engineer with 15+ years of experience, focused on existing system maintenance, bug fixing, performance optimization, server troubleshooting, WordPress maintenance, and small feature iterations.
If your project is facing any of the following issues, we can start with a small troubleshooting task first:
- ✅ PHP / Laravel / Yii2 legacy systems without active maintenance
- ✅ Go / Gin backend APIs that need troubleshooting or optimization
- ✅ Slow, broken, or unstable WordPress websites
- ✅ Nginx / MySQL / Redis / Linux server issues
- ✅ CDN / Cloudflare / DNS / HTTPS configuration problems
- ✅ Long-term remote technical support or part-time maintenance
More details: About Me & Collaboration
WeChat: 13980074657
Email: shuijingwanwq@gmail.com
Telegram: @shuijingwan
GitHub: https://github.com/shuijingwan

Leave a Reply