0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

No application encryption key has been specified.を解決する[laravel]

Posted at

事象

Laravelで環境構築している際、http://localhost:8888/ にアクセスすると、
'No application encryption key has been specified'
というエラー画面が表示されました。

スクリーンショット 2023-06-04 17.07.39.png

調査と試したこと

この記事を読む前に先にこちらの記事を参照されることをおすすめします。
https://qiita.com/tamakiiii/items/0a82ed09e8bced5cd898
https://qiita.com/ponsuke0531/items/197c76fcb9300d7c5f36

既存記事を参考にして、暗号化キーが未設定であることが直接原因のようだとわかり、
下記コマンドを実行するものの、色々とエラーが出てしまいました。

$ php artisan key:generate

エラー:

TypeError: Carbon\Carbon::setLastErrors(): Argument #1 ($lastErrors) must be of type array, bool given
Symfony\Component\ErrorHandler\Error\FatalError: Uncaught Whoops\Exception\ErrorException: Using ${var} in strings is deprecated, use {$var} instead

調べた結果、Composerを使用してCarbonライブラリの最新バージョンにアップデートした方がよいとのことで、
下記コマンドを実行。

composer require nesbot/carbon

それでも、同じようなエラーが出てしまいました。

解決方法

GUIから'Generate app key'を押下することで無事に暗号化キーを作成することができました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?