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

2022-01-08 00:00:00 php laravel composer-php laravel-4

这是我得到的错误:

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]

这显示在:

Writing lock file
Generating autoload files

我尝试删除供应商文件夹中的所有文件夹.但这并没有改变什么.

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

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

I am using MAMP server on my Mac OS X.

PHP 版本 5.4.10

PHP Version 5.4.10

mcrypt 2.5.8

mcrypt 2.5.8

我刚刚尝试了sudo composer update --verbose",我得到了这个错误:

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

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
     ComposerEventDispatcherEventDispatcher->doDispatch() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:107
 ComposerEventDispatcherEventDispatcher->dispatchCommandEvent() at phar:///usr/bin/composer/src/Composer/Installer.php:289
 ComposerInstaller->run() at phar:///usr/bin/composer/src/Composer/Command/UpdateCommand.php:118
 ComposerCommandUpdateCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
 SymfonyComponentConsoleCommandCommand->run() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:897
 SymfonyComponentConsoleApplication->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 SymfonyComponentConsoleApplication->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:117
 ComposerConsoleApplication->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:121
 SymfonyComponentConsoleApplication->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:83
 ComposerConsoleApplication->run() at phar:///usr/bin/composer/bin/composer:43
 require() at /usr/bin/composer:15

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

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

[04-Nov-2013 20:45:44 Europe/Berlin] PHP Fatal error:  Class 'PatchworkUtf8Bootup' 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.

我刚试过这个:

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

我的 PHP 错误日志中出现了新错误:

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

[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): IlluminateContainerContainer->build('config', Array)
#2 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(444): IlluminateContainerContainer->make('config', Array)
#3 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(233): IlluminateFoundationApplication->make('config')
#4 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(3151): IlluminateContainerContainer->offsetGet('config')
#5 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(103): IlluminateExceptionExceptionServiceProvider->IlluminateException{closure}(Object(IlluminateFoundationApplication))
#6 /Applications/MAMP/htdocs/---/bootstrap/compiled.php(163): IlluminateContainerContainer->Illum in /Applications/MAMP/htdocs/---/bootstrap/compiled.php on line 165

推荐答案

我相信这个错误是由于找不到 mcrypt 造成的.

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

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

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

显然安装mcrypt并不是那么容易.

Apparently it is not quite that easy to install mcrypt.

  1. 安装php5-mcrypt包,或验证是否安装正确.

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

sudo apt-get install php5-mcrypt

  • 检查mcrypt是否已安装并启用PHP:

  • Check whether mcrypt has been installed and enabled for PHP:

    php --ri mcrypt
    

  • 如果它说:你就完成了:

  • You're done if it says:

    mcrypt support => enabled
    

    否则,如果显示:

    Extension 'mcrypt' not present.
    

  • 验证 mcrypt.ini 是否存在于 PHP 的 mods-available 目录中.

  • Verify that mcrypt.ini is present in PHP's mods-available directory.

    ls /etc/php5/mods-available/mcrypt.ini
    

  • 如果显示 No such file or directory,则创建一个从 mcrypt.ini 到 PHP 的 mods-available 目录的符号链接.

  • If it says No such file or directory, create a symbolic link from mcrypt.ini to PHP's mods-available directory.

    sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
    

  • 启用模组.

  • Enable the mod.

    sudo php5enmod mcrypt
    

  • 重启apache.

  • Restart apache.

    sudo service apache2 restart
    

  • 再次检查mcrypt是否开启.

    php --ri mcrypt
    

  • 最后的步骤受到 Vuk Stanković 的启发.

    The final steps were inspired by Vuk Stanković.

    相关文章