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

DanielRønfeldt's avatar

Error when trying to install Pest for Laravel 10

I've been following Christoph's indications in his Pest Driven Laravel tutorial https://laracasts.com/series/pest-driven-laravel/episodes/3?page=1

After installing the Pest framework and Pest's Laravel Plugin with Composer, I'm getting an error upon issuing the php artisan pest:install command:

% php artisan pest:install           

   ERROR  Command "pest:install" is not defined. Did you mean one of these?  

  ⇂ migrate:install  
  ⇂ pest:dataset  
  ⇂ pest:test  
  ⇂ sail:install  
  ⇂ test

And therefore I cannot proceed further with the tutorial.

Any help would be greatly appreciated.

0 likes
4 replies
LaryAI's avatar
Level 58

It seems like the pest:install command is not recognized by Artisan, which could be due to a few reasons. Here are some steps you can take to troubleshoot and resolve the issue:

  1. Ensure Pest is Properly Installed: First, make sure that Pest and the Pest Laravel Plugin are indeed installed. You can check this by looking at your composer.json file or by running composer show to list installed packages.

  2. Check Your Composer Autoload: Sometimes, the issue might be with Composer's autoload. Try running composer dump-autoload to regenerate the autoload files.

  3. Clear Caches: Laravel caches configuration and routes, which can sometimes cause issues. Clear the caches by running the following commands:

php artisan config:clear
php artisan cache:clear
  1. Check for the Service Provider: Ensure that the Pest service provider is automatically discovered or manually added to your config/app.php file under the providers array. If it's not there, you might need to add it manually:
/*
 * Package Service Providers...
 */
\Pest\Laravel\PestServiceProvider::class,
  1. Reinstall Pest: If none of the above steps work, try removing Pest and reinstalling it. Run the following commands:
composer remove pestphp/pest --dev
composer remove pestphp/pest-plugin-laravel --dev
composer require pestphp/pest --dev
composer require pestphp/pest-plugin-laravel --dev

After reinstalling, try running the php artisan pest:install command again.

  1. Check for Conflicts: If you have other testing tools or packages installed, they might conflict with Pest. Check for any such conflicts and resolve them.

  2. Check Your Composer Version: Ensure you are using a compatible version of Composer with Laravel 10 and Pest. Laravel 10 requires Composer 2, so make sure you are not using an older version.

  3. Check the Documentation: Ensure that you are following the latest documentation for Pest, as there might have been updates or changes since the tutorial was published.

If you've gone through all these steps and the issue persists, it might be helpful to seek further assistance on the Pest GitHub repository or the Laracasts forums, providing detailed information about your environment and the steps you've taken so far.

Ssionn's avatar
Ssionn
Best Answer
Level 3

Quoting from the pest website:

"The first step is to require Pest as a "dev" dependency in your project by running the following command on your command line."

composer require pestphp/pest --dev --with-all-dependencies

"Secondly, you'll need to initialize Pest in your current PHP project. This step will create a configuration file named Pest.php at the root level of your test suite, which will enable you to fine-tune your test suite later."

./vendor/bin/pest --init

"Finally, you can run your tests by executing the pest command."

./vendor/bin/pest
2 likes

Please or to participate in this conversation.