laravel - 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 文件之外,我的公共目录是空的,这正常吗?
解决方案
我的设置有点错误,我大多忘记运行编译 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
推荐阅读
- eclipse - 打开源文件时,带有 CDT 的 Eclipse 4.11.0 使 java 崩溃
- javascript - JavaScript findIndex 不适用于第一个对象
- python - 语法错误:关键字不能是表达式 - 来自 blackjackcode
- reactjs - Highcharts X轴和y轴
- python - 如何使用这些数据制作直方图?
- go - 如何将时区信息添加到现有 time.Time
- matlab - 提高实时串行数据绘图代码效率的技巧
- spring-kafka - 如何使用 spring kafka 列出订阅/注册的消费者?
- java - 鉴于 JFR 承诺低开销,它如何设法记录堆栈跟踪?
- javascript - 是否可以将数组属性声明为对象并实例化推入它?