1. Building composer failed in the GitLab CI/CD Pipelines. See 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. I searched for Class ‘Faker\Factory’ in the local environment and confirmed that /vendor/fzaninotto/faker/src/Faker/Factory.php exists. Running `php artisan key:generate` in the local environment succeeded. See Figure 2.

PS E:\wwwroot\object> php artisan key:generate
Application key set successfully.
3. I checked the logs in gitlab-runner: `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`. See 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. I ran `composer install –prefer-dist –no-ansi –no-interaction –no-progress –no-scripts –no-dev` in the local environment, and then ran `php artisan key:generate`. It threw an error: In Application.php line 679: Class ‘Barryvdh\Debugbar\ServiceProvider’ not found. The reason should be a difference in configuration between the local and production environments.
PS E:\wwwroot\object> php artisan key:generate
In Application.php line 679:
Class 'Barryvdh\Debugbar\ServiceProvider' not found
5. I ran `composer install –prefer-dist –no-ansi –no-interaction –no-progress –no-scripts` in the local environment, and then ran `php artisan key:generate`. No error occurred this time. This confirmed that the pipeline failure was caused by adding the `–no-dev` option. `–no-dev`: skips packages listed in the require-dev section. In the require-dev configuration of composer.json, there is `”fzaninotto/faker”: “^1.4″`.
"require-dev": {
"fzaninotto/faker": "^1.4",
},
6. I moved `”fzaninotto/faker”: “^1.4″` from the require-dev configuration to the require configuration. The error no longer occurred.
