首页 > 解决方案 > Laravel 6.0.3 未加载关键资源 App.js 或 App.css 404 Not Found

问题描述

为了设置我的项目,我运行了:

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

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

在此处输入图像描述

并因缺少资源而出现两个 404 错误:

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

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

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

标签: laravellaravel-6

解决方案


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

正确的设置命令序列是:

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

推荐阅读