brentxscholl's avatar

Error: Class 'Dotenv\Environment\DotenvFactory' not found When running phpunit test

I have a fresh install of Laravel 8.

When I run phpunit I get an error.

Tests\Feature\ExampleTest::testBasicTest
Error: Class 'Dotenv\Environment\DotenvFactory' not found

I have tried running composer dump-autoload, and I've removed the vendor directory and ran composer update no luck.

Has anyone encountered this problem or know a possible fix?

0 likes
1 reply
brentxscholl's avatar
brentxscholl
OP
Best Answer
Level 17

Turns out I had phpunit installed globally.

composer global remove phpunit/phpunit

did the trick.

Please or to participate in this conversation.