身份验证页面没有在 Laravel 中获取 css
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/58111841/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
auth pages not getting css in laravel
提问by ganesh
I am beginner to laravel. I have created project. And I have run following commands to it.
我是laravel的初学者。我已经创建了项目。我已经对它运行了以下命令。
composer require laravel/ui --dev
npm install
npm run dev
php artisan ui vue
php artisan ui vue --auth
after this command I get Login
and Register
menus on my welcome page.
Now my laravel welcome page loads properly. But when I click on login it shows plain html.
I serached and checked app.blade.php for links of css and js. It looks fine.
layouts/app.blade.php having following links
此命令后,我得到Login
和Register
我的欢迎页面上的菜单。现在我的 Laravel 欢迎页面可以正确加载。但是当我点击登录时,它显示的是纯 html。我搜索并检查了 app.blade.php 中的 css 和 js 链接。看起来不错。layouts/app.blade.php 有以下链接
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<script src="{{ asset('js/app.js') }}" defer></script>
Where should be the problem? Why Login and Register not getting css, when welcome page gets css? Please guide.
问题应该出在哪里?当欢迎页面获取 css 时,为什么登录和注册没有获取 css?请指导。
回答by Habib Rayan
Step 1:
第1步:
- Download nodejs
- Install nodejsin your pc
- 下载nodejs
- 在你的电脑上安装nodejs
Step 2:
第2步:
- then open your project root and command
composer require laravel/ui
php artisan ui vue --auth
npm install
npm run dev
- 然后打开你的项目根目录和命令
composer require laravel/ui
php artisan ui vue --auth
npm install
npm run dev
for help see this video: https://www.youtube.com/watch?v=hOYW3jqh19I&t=9s
如需帮助,请观看此视频:https: //www.youtube.com/watch?v=hOYW3jqh19I&t=9s
回答by Abdullah
You can download these two files from here :
您可以从这里下载这两个文件:
Then create cssand jsfolders into publicfolder just put :
然后将css和js文件夹创建到public文件夹中,只需放置:
CSS file : app.cssinto project_folder/public/css/
CSS 文件:app.css到 project_folder/public/css/
JS file : app.jsinto project_folder/public/js/
JS 文件:app.js到 project_folder/public/js/
Its work for me. I think it will also work for you. Thanks.
它对我来说有效。我认为它也适合你。谢谢。
回答by Prafulla Kumar Sahu
Some times cache can be the issue in such case, you can run
在这种情况下,有时缓存可能是问题,您可以运行
php artisan cache:clear
and optionally php artisan view:clear
.
php artisan cache:clear
和可选的php artisan view:clear
。
回答by Ian Farré
For me it was simply the npm run dev
command.
In my ubuntu 19.10, it has to run with sudo
对我来说,这只是npm run dev
命令。在我的 ubuntu 19.10 中,它必须与 sudo 一起运行
回答by user13226151
Run the command:
运行命令:
npm uninstall popper.js && npm i @popperjs/core
to remove the deprecated package and install their new Popper v2.
删除弃用的软件包并安装他们的新 Popper v2。