Laravel 6.0.3未加载关键资源App.js或App.css 404未找到 [英] Laravel 6.0.3 Not Loading Key Resources App.js or App.css 404 Not Found

查看:718
本文介绍了Laravel 6.0.3未加载关键资源App.js或App.css 404未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要运行我的项目,请运行:

To setup my project I ran:

laravel new cms
composer require laravel/ui
php artisan ui:auth
php artisan migrate

但是,当我转到 http://cms.test/login 时,将显示登录页面:

However, when I go to http://cms.test/login I am shown the login page:

并因缺少资源而收到两个404错误:

And get two 404 errors for missing resources:

http://cms.test/js/app.js net::ERR_ABORTED 404 (Not Found)
http://cms.test/css/app.css

这些文件丢失的原因可能是什么?

What could be the reason for these missing files?

除了.htaccess,favicon.ico,index.php和robot.txt文件之外,我的公共目录是空的吗?

My public directory is empty aside from .htaccess, favicon.ico, index.php and robot.txt files, is that normal?

推荐答案

我的设置有点错误,我大部分都忘记了运行编译app.js和app.css文件所需的npm install和npm run dev命令

My setup was a little wrong, I mostly forgetting to run npm install and npm run dev command that is required to compile the app.js and app.css files.

正确的设置命令顺序为:

Correct setup command sequence was:

laravel new cms
cd cms
php artisan migrate
composer require laravel/ui
npm install
php artisan ui vue --auth
npm install && npm run dev

这篇关于Laravel 6.0.3未加载关键资源App.js或App.css 404未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆