Joynal Abedin
Joynal Abedin

Reputation: 75

laravel 7 artisan key:generate not working

when i run php artisan key:generate in cmd it's return

file_get_contents(/project/positiv/core/vendor/psy//.env): failed to open stream: No such file or directory

at

/project/positiv/core/vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php:96
{
    file_put_contents($this->laravel->environmentFilePath(), preg_replace(
        $this->keyReplacementPattern(),
        'APP_KEY='.$key,
        file_get_contents($this->laravel->environmentFilePath())
    ));
}

I am trying to generate APP_KEY!!!

Upvotes: 0

Views: 1963

Answers (2)

pandesantos
pandesantos

Reputation: 369

At first generate APP_KEY with the command php artisan key:generate --show. It will print contents on your terminal which you can copy and paste wherever you want. In this case APP_KEY=value on your .env file.

Generated Key format will be something like base64:xxxxxxxxxxxxxxxxxxxxxxx.

Upvotes: 4

Anorbert
Anorbert

Reputation: 46

It seems that you are trying to run artisan command outside the project.

Make sure your terminal is targeting the exact project you want to trigger

Upvotes: 0

Related Questions