laravel6でユーザ認証を導入するために以下のコマンドを実行しました。
$composer require laravel/ui --dev
$php artisan ui vue --auth
$npm install --no-bin-links
$npm run dev
laravelトップページから認証用ページを確認しましたが、bootstrapのレイアウトが正常に反映されておらず困っております。
laravel mixやnpmは今まで使用したことがないため理解が浅いですが、ご教授いただけると幸いです。
以下コマンド実行時の結果です。
composer require laravel/ui --dev
Using version ^1.2 for laravel/ui ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 1 install, 0 updates, 0 removals - Installing laravel/ui (v1.2.0): Downloading (100%) Writing lock file Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi Discovered Package: facade/ignition Discovered Package: fideloper/proxy Discovered Package: laravel/tinker Discovered Package: laravel/ui Discovered Package: nesbot/carbon Discovered Package: nunomaduro/collision Package manifest generated successfully.
php artisan ui vue --auth
Vue scaffolding installed successfully. Please run "npm install && npm run dev" to compile your fresh scaffolding. Authentication scaffolding generated successfully.
npm install --no-bin-links
npm WARN rollback Rolling back fsevents@1.2.11 failed (this is probably harmless): ETXTBSY: text file is busy, rmdir '/var/www/node_modules/chokidar/node_modules/fsevents/node_modules' npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) added 1041 packages from 492 contributors and audited 17267 packages in 103.06s 34 packages are looking for funding run `npm fund` for details found 0 vulnerabilities
npm run dev
> @ dev /var/www > node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js 98% after emitting SizeLimitsPlugin DONE Compiled successfully in 27288ms 9:34:25 AM Asset Size Chunks Chunk Names /css/app.css 177 KiB /js/app [emitted] /js/app /js/app.js 1.39 MiB /js/app [emitted] /js/app
package.jsonファイル
※npm run dev実行時に
sh: 1: cross-env: not found
のエラーが起きたので、以下のQAを参考に"scripts"部分を編集しました
リンク内容
{ "private": true, "scripts": { "dev": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch-poll": "npm run watch -- --watch-poll", "hot": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "prod": "npm run production", "production": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }, "devDependencies": { "axios": "^0.19", "bootstrap": "^4.0.0", "cross-env": "^5.2.1", "jquery": "^3.2", "laravel-mix": "^5.0.1", "lodash": "^4.17.13", "popper.js": "^1.12", "resolve-url-loader": "^2.3.1", "sass": "^1.20.1", "sass-loader": "^8.0.0", "vue": "^2.5.17", "vue-template-compiler": "^2.6.10" } }
layouts/app.phpファイルのhead部分
<!doctype html> <html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- CSRF Token --> <meta name="csrf-token" content="{{ csrf_token() }}"> <title>{{ config('app.name', 'Laravel') }}</title> <!-- Scripts --> <script src="{{ asset('js/app.js') }}" defer></script> <!-- Fonts --> <link rel="dns-prefetch" href="//fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet"> <!-- Styles --> <link href="{{ asset('css/app.css') }}" rel="stylesheet"> </head>
開発環境
ホストOS:windows10 home
laradock
dooker-toolbox
node:v13.9.0
npm:6.13.7
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。