简体   繁体   中英

Not able to generate php artisan key after copying .env file

i had unextracted a project file from git and i want to use it in the local server but when i copy paste the .env and run the command to generate the key. their seems to be an error.

i tried installing auto-dumpload command but it doesnt seem to work

php artisan key:generate  

ErrorException : file_get_contents(C:\\Users\\Anifz\\React\\getfyt-webapp-master.env): failed to open stream: No such file or directory

at C:\\Users\\Anifz\\React\\getfyt-webapp-master\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\KeyGenerateCommand.php:96 92| { 93| file_put_contents($this->laravel->environmentFilePath(), preg_replace( 94| $this->keyReplacementPattern(), 95| 'APP_KEY='.$key, 96| file_get_contents($this->laravel->environmentFilePath()) 97| )); 98| } 99| 100| /**

Exception trace:

1
file_get_contents("C:\\Users\\Anifz\\React\\getfyt-webapp-master.env") C:\\Users\\Anifz\\React\\getfyt-webapp-master\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\KeyGenerateCommand.php:96

2
Illuminate\\Foundation\\Console\\KeyGenerateCommand::writeNewEnvironmentFileWith("base64:psZqTYKIKLRKPOhzVWUWZ2pny7A/nb4ArWeklrKWofE=") C:\\Users\\Anifz\\React\\getfyt-webapp-master\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\KeyGenerateCommand.php:80

Please use the argument -v to see more details.

The Following are the steps that you should follow -

  1. extract the project.
  2. copy .env.example to .env
  3. run composer install
  4. then run php artisan key:generate

I think .env file not exist ,if exist file copy one from .env.examle and set name as .env

Exec this code

php artisan key:generate

Maybe u want clear cache if want it u can with below code

php artisan cache:clear

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