当我尝试使用官方指南将我们现有的项目从Laravel 5.1更新到Laravel 5.2时,在更新后的作曲家更新后出现错误
php artisan clear-compiled
正在运行。这是错误。
类Illuminate \ Foundation \ Composer不存在
有没有人有类似的问题?当我使用无脚本标志运行composer update时,它会定期更新,因此在clear-compiled上会出现问题。
以下是我的服务提供商和我的composer.json文件。
服务提供商
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
// Illuminate\Redis\RedisServiceProvider::class,
Vetruvet\PhpRedis\PhpRedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
Laravel\Socialite\SocialiteServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
Torann\GeoIP\GeoIPServiceProvider::class,
Jenssegers\Agent\AgentServiceProvider::class,
Barryvdh\Debugbar\ServiceProvider::class,
composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"fzaninotto/faker": "^1.6@dev",
"laravelcollective/html": "5.2.*",
"laravelcollective/remote": "~5.2",
"kriswallsmith/assetic": "^1.3@dev",
"pda/pheanstalk": "^3.0@dev",
"aws/aws-sdk-php-laravel": "~3.0",
"illuminate/http": "~5.2",
"illuminate/session": "~5.2",
"illuminate/support": "~5.2",
"nesbot/carbon": "~1.18",
"guzzlehttp/guzzle": "~5.3|~6.0",
"vetruvet/laravel-phpredis": "dev-master",
"predis/predis": "^1.1@dev",
"laravel/socialite": "^3.0@dev",
"intervention/image": "^2.3@dev",
"brightcove/api": "^1.0@dev",
"torann/geoip": "dev-master",
"graham-campbell/throttle": "~5.1",
"jenssegers/agent": "^3.0@dev"
},
"require-dev": {
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"symfony/dom-crawler": "~3.0",
"symfony/css-selector": "~3.0",
"barryvdh/laravel-debugbar": "^2.0@dev",
"laracasts/generators": "dev-master"
},
"repositories": [
{
"type": "git",
"url": "https://github.com/nardev/laravel-vzaar.git"
}
],
"autoload": {
"classmap": [
"database",
"app/Models",
"app/Footgoll"
],
"files": [
"app/helpers.php"
],
"psr-4": {
"Myapp\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev",
"prefer-stable": true
}
当我跑步时
grep -nH -d recurse'Composer'bootstrap / app / config /
这是返回的内容:
自举/ autoload.php:7:|注册Composer Auto Loader 引导/ autoload.php:10:| Composer提供了一个方便的,自动生成的类加载器 引导/ autoload.php:42:|在当地工作。但是我们需要加载Composer
这是autoload.php文件的样子:
<?php
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Include The Compiled Class File
|--------------------------------------------------------------------------
|
| To dramatically increase your application's performance, you may use a
| compiled class file which contains all of the classes commonly used
| by a request. The Artisan "optimize" is used to create this file.
|
*/
$compiledPath = __DIR__.'/cache/compiled.php';
if (file_exists($compiledPath)) {
require $compiledPath;
}
/*
|--------------------------------------------------------------------------
| Register The Workbench Loaders
|--------------------------------------------------------------------------
|
| The Laravel workbench provides a convenient place to develop packages
| when working locally. However we will need to load in the Composer
| auto-load files for the packages so that these can be used here.
|
*/
if (is_dir($workbench = __DIR__.'/../workbench'))
{
Xtwoend\Workbench\Starter::start($workbench);
}
可能是关于工作台的事情吗?
更新:将Composer.php从5.1返回到vendor / laravel / framework / src / Illuminate / Foundation的一个非常可怕的修复程序让应用程序正常运行,但我真的需要一个更好的解决方案,一个可以推向生产的解决方案。
答案 0 :(得分:3)
您获得的错误都与您使用的软件包有关。由于Composer类的位置已更改,因此无法找到它。
从升级说明:
Illuminate\Foundation\Support\Composer
课程已移至Illuminate\Support\Composer
。
等待拉取请求被接受,例如,laracasts/generators
文件中包含的composer.json
包是与Laravel 5.2不兼容的软件包之一
https://github.com/laracasts/Laravel-5-Generators-Extended/issues/81
因此,发生此错误的最常用软件包之一是cviebrock/eloquent-sluggable
。
https://github.com/cviebrock/eloquent-sluggable/issues/214
没有什么可以,只能等待拉取请求被接受或只是编辑供应商文件,这不是那么酷的选择。
答案 1 :(得分:2)
尝试
php artisan optimize --force
如果错误继续,请删除vendor / compiled.php,然后运行上面的命令 这将重新创建vendor / compiled.php类。
上面的命令删除了两个文件
bootstrap / compiled.php文件。您创建此文件 优化课程。 app / storage / meta / services.json文件。这个文件 在Laravel尝试优化服务加载时创建 您的应用程序使用的提供程序。
当我运行clear-compiled时,它删除了我项目中的vendor / compiled.php。
由于您根本没有编译类,因此您可能无法删除它。这一定是你遇到问题的原因。不要打扰清理已编译的类..
我也将一个巨大的应用程序从4.2升级到5.0。问题问题.. :)
答案 2 :(得分:1)
这里正在识别和讨论这个错误:
答案 3 :(得分:1)
可能是SocialiteServiceProvider,也可能是其他人。
昨晚升级时我遇到了这个问题,许多服务提供商也必须将代码升级到5.2。
AdamWathan \ EloquentOAuthL5 \安装似乎直接使用Composer类,删除此服务提供程序,您可以继续升级。
答案 4 :(得分:1)
试试这个:
composer update
它让我看到了"laravelcollective/html": "5.1.*"
失败原因的详细解释。对我来说,我正在更新到laravel 5.2,但忘了将"laravelcollective/html": "5.2.*"
更新为<!DOCTYPE html>
<html>
<head>
<title>Strategy - Time Zero</title>
<script src="js/jquery/jquery-1.12.3.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="js/Highcharts/Highcharts-4.2.3/highcharts.js"></script>
<script src="js/Highcharts/Highcharts-4.2.3/modules/exporting.js"></script>
<script>
var chart;
var dataSource = 'getTrendData-TimeZero.php?format=json';
var ChartHeight = window.innerHeight;
var dataForTwoSeries = [];
var seriesOne = [];
var seriesTwo = [];
function requestData() {
$.ajax({url: dataSource, success: function(dataPoints)
{
$.each(dataForTwoSeries, function(index, dataPoints){
var seriesOneDataPoint = [dataPoints[1], dataPoints[0]];
var seriesTwoDataPoint = [dataPoints[2], dataPoints[0]];
window.alert(seriesOneDataPoint)
seriesOne.push(seriesOneDataPoint);
seriesTwo.push(seriesTwoDataPoint);
chart.series[0].setData(seriesOne, false); //redraw after setting data for second series
chart.series[1].setData(seriesTwo); //boolean redraw is true by default, don't need to pass it
setTimeout(requestData, 2500);
});
},
cache: false
});
}
$(document).ready(function() {
//add our div for the chart
$("#container").append("<div id=chart-TimeZero style='width:100%''></div>");
//StockChart
//Chart
chart = new Highcharts.Chart({
chart: {
height: ChartHeight,
renderTo: 'chart-TimeZero',
defaultSeriesType: 'line',
events: {
load: function() {
requestData();
}
},
},
tooltip: {
enabled: true,
formatter: function() {
if (this.y < 0)
{
h = Math.ceil(this.y / 3600);
m = Math.ceil(this.y / 60);
s = Math.ceil(this.y % 60);
h = Math.abs(h);
m = Math.abs(m);
s = Math.abs(s);
s = s % 60;
m = m % 60;
h = h % 24;
if (h < 9) h = "-0" + h;
if (m < 9) m = "0" + m;
if (s < 9) s = "0" + s;
}
else
{
h = Math.floor(this.y / 3600);
m = Math.floor(this.y / 60);
s = Math.floor(this.y % 60);
h = Math.abs(h);
m = Math.abs(m);
s = Math.abs(s);
s = s % 60;
m = m % 60;
h = h % 24;
if (h < 9) h = "0" + h;
if (m < 9) m = "0" + m;
if (s < 9) s = "0" + s;
}
return '<span style="color:black">Time Zero</span> ' + [h, m, s].join(':');
}
},
title: {
text: 'TIME ZERO'
},
subtitle: {
text: 'BEST 5 CAR AVEREGE LAPTIME IN LAST 10 MINUTES'
},
xAxis: {
type: 'datetime',
title: {text: 'DAY TIME'}
},
yAxis: {
title: {text: 'TIME ZERO'},
labels: {
formatter: function() {
if (this.value < 0)
{
h = Math.ceil(this.value / 3600);
m = Math.ceil(this.value / 60);
s = Math.ceil(this.value % 60);
h = Math.abs(h);
m = Math.abs(m);
s = Math.abs(s);
s = s % 60;
m = m % 60;
h = h % 24;
if (h < 9) h = "-0" + h;
if (m < 9) m = "0" + m;
if (s < 9) s = "0" + s;
}
else
{
h = Math.floor(this.value / 3600);
m = Math.floor(this.value / 60);
s = Math.floor(this.value % 60);
h = Math.abs(h);
m = Math.abs(m);
s = Math.abs(s);
s = s % 60;
m = m % 60;
h = h % 24;
if (h < 9) h = "0" + h;
if (m < 9) m = "0" + m;
if (s < 9) s = "0" + s;
}
return [h, m, s].join(':');
}
}
},
series: [{
name: 'seriesName1',
showInLegend: true,
data: [],
},{
name: 'seriesName2',
showInLegend: true,
data: [],
}]
}); //end chart
}); //end document.ready
</script>
</head>
<body>
<div id="container"></div>
</body>
</html>
。
答案 5 :(得分:0)
Welp,我刚刚用5.2创建了一个新的laravel应用程序并再次添加了所有代码和依赖项,现在似乎正在运行。