1
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.

【Laravel9】Laravel UIを使ってログイン機能を実装する

Posted at

Laravel UIをインストールする

composer require laravel/ui

そうすると僕の場合は下記のようなエラーが起きてしまったので、

Root composer.json requires laravel/ui ^4.0 -> satisfiable by laravel/ui[v4.0.0, v4.0.1, v4.0.2, 4.x-dev].

どうやらバージョンを指定してあげないといけないそう。
なので、

composer require laravel/ui:3.*

今回は3系を指定してインストールしてみました。(成功)

バージョンに関しては、
https://packagist.org/packages/laravel/ui#3.x-dev
を参照。

ログイン機能を実装させる

php artisan ui bootstrap --auth

そうすると、僕の場合は、
yes,noをいくつか求められたので、全てnoにして進みました。
また下記のように出力がされるので、求められている通り、
npm install && npm run devを入力する。

※これは入力しない※
Bootstrap scaffolding installed successfully.
Please run "npm install && npm run dev" to compile your fresh scaffolding.

そうすると僕の場合、nodeをインストールしていなかったので、
bash: npm: command not foundが吐かれてしまったので、nodeをインストールしてあげます。

nodeのインストール方法は下記サイトが非常に役立ったので、そちら参照です。
https://qiita.com/kyosuke5_20/items/c5f68fc9d89b84c0df09

インストールできたら、
改めて、下記を打ち込む。

$ npm install && npm run dev

そうすると下記のような出力がされるので、

$ npm install && npm run dev 
//略
Additional dependencies must be installed. This will only take a moment.
 
Running: npm install resolve-url-loader@^5.0.0 --save-dev --legacy-peer-deps
 
Finished. Please run Mix again.

指示通り、npm install resolve-url-loader@^5.0.0 --save-dev --legacy-peer-depsを打ち込む。

$ npm install resolve-url-loader@^5.0.0 --save-dev --legacy-peer-deps

再度npm run devコマンドを打ち込みビルドさせる

$ npm run dev

webpack compiled successfully

これから、メール認証やSNS認証だったりとログイン周りでも追加したいことが多いので
色々と調べながら進めていきます。

以上。

1
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
1
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?