Laravel 错误报告问题汇总
Posted Grace_Zhong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Laravel 错误报告问题汇总相关的知识,希望对你有一定的参考价值。
Laravel
Postman
Validation rule unique requires at least 1 parameters
testController.php 去掉 unique
public function register(Request $request){
$request -> validate([
'name' => 'min:3',
'email' => 'required|email',
'password' => 'required|min:6',
]);
GET http://127.0.0.1:8000/js/reset-password/app.js net::ERR_ABORTED 404 (Not Found)
webpack.mix.js 中添加,使用 npm run dev 时将 resources/js/reset-password/app.js 编译到 public/js/reset-password/app.js
mix.js(‘resources/js/reset-password/app.js’, ‘public/js/reset-password’)
Class ‘Illuminate\\Support\\Facades\\Input’ not found
Laravel 5.2 及以上版本用 Request 代替了 Input 类
用 Illuminate\\Support\\Facades\\Request 代替 Illuminate\\Support\\Facades\\Input
Laravel Passport
php artisan passport:install 报错 SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘provider’ in ‘field list’ (SQL: insert into oauth_clients
Reference SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘provider’ in ‘field list’ (SQL: insert into oauth_clients
database/migrations 中没有 oauth 相关的文件,复制进去执行 php artisan migrate:fresh
Laravel npm run dev
Mix/Webpack
[webpack-cli] TypeError: Cannot read property ‘babel’ of undefined
问题原因
package.json 中 depandences 版本不对应
package.json 的各个 dependences 版本前
使用 npm install 安装相关依赖时
‘^’ 表示会更新major version,自动更新当前包的最新版本,例如 “vue”: “^1.0.0” 会更新到 “vue”: “^2.6.11”
'~'表示会更新minor version,例如 “vue”: “^2.6.5” 会更新到 “vue”: “^2.6.11”
没有 ‘^’ 或 ‘~’ 只安装当前版本
解决方法
去掉 package.json 中所有的 ‘~’ 和 ‘^’
删除 package-lock.json
执行 npm install
Laravel + XDebug
Illuminate\\Contracts\\Encryption\\DecryptException: The payload is invalid.
在 package.json 中添加代码
"ignore": [
"**/vendor/**/*.php"
]
如下
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 8088,
"ignore": [
"**/vendor/**/*.php"
]
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 8088
}
]
}
清缓存
php artisan cache:clear
php artisan view:clear
php artisan optimize
以上是关于Laravel 错误报告问题汇总的主要内容,如果未能解决你的问题,请参考以下文章