php 我的作曲家不会用 Laravel 4 完全更新它会被工匠卡住

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19775012/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 20:00:10  来源:igfitidea点击:

My composer won't update completely with Laravel 4 it gets stuck with artisan

phplaravellaravel-4composer-php

提问by jnbdz

Here is the error I am getting:

这是我得到的错误:

Script php artisan optimize handling the post-update-cmd event returned with an error

[RuntimeException]  
Error Output:

update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

This shows after:

这显示在:

Writing lock file
Generating autoload files

I tried to delete all my folders in my vendor folder. But that did not change anything.

我试图删除我的供应商文件夹中的所有文件夹。但这并没有改变任何事情。

I am using MAMP server on my Mac OS X.

我在 Mac OS X 上使用 MAMP 服务器。

PHP Version 5.4.10

PHP 版本 5.4.10

mcrypt 2.5.8

mcrypt 2.5.8

I just tried "sudo composer update --verbose" and I got this error:

我刚刚尝试了“sudo composer update --verbose”,但出现此错误:

sudo composer update --verbose
Password:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Generating autoload files
Script php artisan optimize handling the post-update-cmd event returned with an error

  [RuntimeException]  
  Error Output:
    Exception trace:
     () at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:148
     Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:107
 Composer\EventDispatcher\EventDispatcher->dispatchCommandEvent() at phar:///usr/bin/composer/src/Composer/Installer.php:289
 Composer\Installer->run() at phar:///usr/bin/composer/src/Composer/Command/UpdateCommand.php:118
 Composer\Command\UpdateCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:897
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:117
 Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:121
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:43
 require() at /usr/bin/composer:15

Here is the error I found in my PHP error logs:

这是我在 PHP 错误日志中发现的错误:

[04-Nov-2013 20:45:44 Europe/Berlin] PHP Fatal error:  Class 'Patchwork\Utf8\Bootup' not found in /Applications/MAMP/htdocs/-----/bootstrap/autoload.php on line 46

I just tried to test my composer:

我只是试图测试我的作曲家:

sudo composer diagnose
Password:
Checking platform settings: OK
Checking http connectivity: OK
Checking composer.json: FAIL
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Name "andrew13/Laravel-4-Bootstrap-Starter-Site" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "andrew13/laravel-4-bootstrap-starter-site" instead. As such you will not be able to submit it to Packagist.
Checking disk free space: OK
Checking composer version: OK

Just applied the recommendation in the error message from the last command. Now everything is showing as OK.

刚刚应用了上一条命令的错误消息中的建议。现在一切都显示正常。

I just tried this:

我刚试过这个:

curl -sS https://getcomposer.org/installer | php -- --check
#!/usr/bin/env php
All settings correct for using Composer

I am now getting new errors in my PHP Error logs:

我现在在我的 PHP 错误日志中收到新错误:

[05-Nov-2013 05:45:45 Europe/Berlin] PHP Fatal error:  Uncaught exception 'ReflectionException' with message 'Class config does not exist' in /Applications/MAMP/htdocs/---/bootstrap/compiled.php:165
Stack trace:
#0 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(165): ReflectionClass->__construct('config')
#1 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(142): Illuminate\Container\Container->build('config', Array)
#2 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(444): Illuminate\Container\Container->make('config', Array)
#3 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(233): Illuminate\Foundation\Application->make('config')
#4 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(3151): Illuminate\Container\Container->offsetGet('config')
#5 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(103): Illuminate\Exception\ExceptionServiceProvider->Illuminate\Exception\{closure}(Object(Illuminate\Foundation\Application))
#6 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(163): Illuminate\Container\Container->Illum in /Applications/MAMP/htdocs/---/bootstrap/compiled.php on line 165

回答by Daniel A.A. Pelsmaeker

I believe this error results from not being able to find mcrypt.

我相信此错误是由于无法找到mcrypt.

Script php artisan optimize handling the post-update-cmd event returned with an error

脚本 php artisan 优化处理返回错误的 post-update-cmd 事件

Apparently it is not quite that easy to install mcrypt.

显然它不是很容易安装mcrypt

  1. Install the php5-mcryptpackage, or verify that it has been installed correctly.

    sudo apt-get install php5-mcrypt
    
  2. Check whether mcrypthas been installed and enabled for PHP:

    php --ri mcrypt
    
  3. You're done if it says:

    mcrypt support => enabled
    

    Otherwise, continue if it says:

    Extension 'mcrypt' not present.
    
  4. Verify that mcrypt.iniis present in PHP's mods-availabledirectory.

    ls /etc/php5/mods-available/mcrypt.ini
    
  5. If it says No such file or directory, create a symbolic link from mcrypt.inito PHP's mods-availabledirectory.

    sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
    
  6. Enable the mod.

    sudo php5enmod mcrypt
    
  7. Restart apache.

    sudo service apache2 restart
    
  8. Check again whether mcryptis enabled.

    php --ri mcrypt
    
  1. 安装php5-mcrypt软件包,或验证它是否已正确安装。

    sudo apt-get install php5-mcrypt
    
  2. 检查是否mcrypt已安装并启用PHP:

    php --ri mcrypt
    
  3. 如果它说:

    mcrypt support => enabled
    

    否则,如果它说:

    Extension 'mcrypt' not present.
    
  4. 验证它mcrypt.ini是否存在于 PHPmods-available目录中。

    ls /etc/php5/mods-available/mcrypt.ini
    
  5. 如果显示为No such file or directory,则创建一个指向mcrypt.iniPHPmods-available目录的符号链接。

    sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
    
  6. 启用模组。

    sudo php5enmod mcrypt
    
  7. 重启阿帕奇。

    sudo service apache2 restart
    
  8. 再次检查是否mcrypt启用。

    php --ri mcrypt
    

The final steps were inspired by Vuk Stankovi?.

最后一步的灵感来自Vuk Stankovi?.

回答by Fleshgrinder

Okay, did some further research with Google and it seems that this has to do with the autoload caching from Composer. There are various ways on how you can solve this.

好的,与谷歌做了一些进一步的研究,这似乎与 Composer 的自动加载缓存有关。有多种方法可以解决这个问题。

composer dump-autoload

This would re-create the autoload stuff for you and it shouldsolve your problem for now.

这将为您重新创建自动加载内容,现在应该可以解决您的问题。

If this doesn't help, try deleting everythingand re-install fresh: [ref]

如果这没有帮助,请尝试删除所有内容并重新安装:[ref]

rm -rf /path/to/composer.lock /path/to/vendor/
composer install

This would re-create just about everything.

这将重新创建几乎所有内容。

回答by Hailwood

It looks like your laravel install did not run correctly and since part of the composer.jsonruns the php artisan clear-compiledand php artisan optimizeif your laravel application is not working then composer will fail.

看起来您的 laravel 安装没有正确运行,并且由于部分composer.json运行php artisan clear-compiledphp artisan optimize如果您的 laravel 应用程序不工作,那么 composer 将失败。

Try running your composer update without invoking the Laravel scripts.

尝试在不调用 Laravel 脚本的情况下运行 Composer 更新。

php composer update --no-scripts

After that you can either run the commands from the scripts block in your composer.json manually. Else you can just run a standard

之后,您可以手动运行 composer.json 中脚本块中的命令。否则你可以运行一个标准

php composer update

again which will run the scripts for you.

再次为您运行脚本。

回答by BM2ilabs

To fix this you need to install mcrypt.
In ubuntu execute the following command:

要解决此问题,您需要安装mcrypt.
在 ubuntu 中执行以下命令:

sudo apt-get install php5-mcrypt

Then update composer:

然后更新作曲家:

composer update 

回答by X Sham

Another solution for me, setting xdebug.scream = 1gives problem:

对我来说另一个解决方案,设置xdebug.scream = 1给出了问题:

1) Find xdebug configuration file.

1) 找到xdebug 配置文件。

$ sudo find / -name xdebug.ini

2) Edit file using any text editor.

2) 使用任何文本编辑器编辑文件。

$ sudo vi /your_path/xdebug.ini

3) Set xdebug.scream = 0

3) 设置 xdebug.scream = 0

4) Reload server

4)重新加载服务器

$ sudo service apache2 reload

回答by Mohamed Azher

I had a similar issue when trying to run composer update and none of the solutions above had worked. It turns out I had 2 require sections in my composer.json which is actually wrong.

我在尝试运行 composer update 时遇到了类似的问题,但上述解决方案都没有奏效。事实证明,我的 composer.json 中有 2 个 require 部分,这实际上是错误的。

"require": {
    "laravel/framework": "4.1.*"
},
"config": {
    "preferred-install": "dist"
},
"minimum-stability": "stable",
"require": {
    "barryvdh/laravel-ide-helper": "1.*",
    "zizaco/confide": "3.2.x",
    "laravelbook/ardent": "dev-master",
    "zizaco/entrust": "dev-master"
},
"require-dev": {
    "way/generators": "2.*",
    "fzaninotto/faker": "1.3.*@dev"
}

Combining the two as below solved my issue.

将两者结合如下解决了我的问题。

"require": {
    "laravel/framework": "4.1.*",
    "barryvdh/laravel-ide-helper": "1.*",
    "zizaco/confide": "3.2.x",
    "laravelbook/ardent": "dev-master",
    "zizaco/entrust": "dev-master"
},

If you still have a problem, try deleting the composer.lock and the vendor directory and run

如果仍然有问题,请尝试删除 composer.lock 和 vendor 目录并运行

mv ~/.composer/cache ~/.composer/cache.bak

To clear the composer cache and finally run

清除作曲家缓存并最终运行

sudo composer install

This should solve the issue.

这应该可以解决问题。