每次我运行命令composer install --no-dev
我收到此错误,我在laravel中使用maatwebsite作为错误指出,我只是不知道如何解决它。
PHP致命错误:未捕获 Symfony的\分量\调试\异常\ FatalThrowableError
:找不到类'PHPExcel_Shared_Font' /var/www/laravel/config/excel.php:18
2堆栈跟踪:0 / var / www / laravel / vendor / laravel / framework / src / Illuminate / Foundation / Bootstrap
/LoadConfiguration.php(60):require()
1 / var / www / laravel / vendor / laravel / framework / src / Illuminate / Foundation / Bootstrap
/LoadConfiguration.php(38): 照亮\基金会\引导\ LoadConfiguration-→1
oadConfigurationFiles(对象(照亮\基金会\应用程序), 对象(Illumina公司
TE \配置\库))2 / var / www / laravel / vendor / laravel / framework / src / Illuminate / Foundation / Applicati
on.php(203): 照亮\基金会\引导\ LoadConfiguration->自举(对象
(照亮\基金会\应用程序))3 / var / www / laravel / vendor / laravel / framework / src / Illuminate / Foundation / Console / K
ernel.php(268): 照亮\基金会\应用 - > bootstrapWith(阵列)
4 / var / www / laravel / vendor / laravel / framework / src / Illuminate / Foundation / Console / K
ernel.php(114):Illuminate \ Foundation \ Console \ Kernel-> boo in 在/ var / WWW / laravel / CO
第182行的nfig / excel.php脚本php artisan优化处理 使用er
返回的post-install-cmd事件 ror代码255
更新: 这是composer.json文件内容
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*",
"maatwebsite/excel": "~2.1.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
答案 0 :(得分:1)
我认为您收到此错误的原因是因为您正在运行--no-dev
并且maatwebsite/excel
已列为require-dev
依赖项。
您需要将其作为dev依赖项删除,然后将其作为普通依赖项进行处理,它应该没问题。
希望这有帮助!