简体   繁体   中英

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 !!!

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 someht base64:xxxxxxxxxxxxxxxxxxxxxxx.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM