脚本php artisan clear-compiled处理返回的错误前更新-cmd事件(Laravel 4.1升级)

use*_*337 16 php laravel composer-php laravel-4

我最近尝试从Laravel 4.0升级到Laravel 4.1,运行php composer.phar update时出现以下错误:

Script php artisan clear-compiled handling the pre-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]
Run Code Online (Sandbox Code Playgroud)

我只要求:

"require": {
        "laravel/framework": "4.1.*",
        "way/generators": "2.*",
        "madewithlove/laravel-oauth2": "0.4.*"
    },
Run Code Online (Sandbox Code Playgroud)

另外,我在错误之前收到了这个(即使我在我的环境中运行php 5.4.10):

phpseclib/phpseclib suggests installing ext-gmp (Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.)
phpseclib/phpseclib suggests installing pear-pear/PHP_Compat (Install PHP_Compat to get phpseclib working on PHP < 4.3.3.)
d11wtq/boris suggests installing ext-readline (*)
d11wtq/boris suggests installing ext-pcntl (*)
Writing lock file
Generating autoload files
Run Code Online (Sandbox Code Playgroud)

编辑:

在composer.json中使用的脚本:

"scripts": {
        "pre-install-cmd": [
            "php artisan clear-compiled"
        ],
        "post-install-cmd": [
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
Run Code Online (Sandbox Code Playgroud)

小智 8

也许你可以尝试这个命令:

composer install --no-scripts
Run Code Online (Sandbox Code Playgroud)

  • 这篇文章并不是回答问题的实际尝试。请注意[StackOverflow 不像论坛那样工作](http://stackoverflow.com/tour),它是一个问答网站,每个帖子要么是一个问题,要么是一个问题的答案。帖子也可以有 [评论](http://stackoverflow.com/help/privileges/comment) - 像这样的小句子 - 可用于批评或要求作者澄清。这应该是评论或 [新问题](http://stackoverflow.com/questions/ask) (3认同)
  • 但这是对我的案例有帮助的实际解决方案。 (2认同)

use*_*178 7

你有没有按照升级程序?跑步composer update还不够.laravel.com/docs/upgrade


小智 7

尝试删除/bootstrap/compiled.php(我在降级Laravel 4.2> 4.1时遇到了麻烦)

然后尝试composer update,它应该工作.

祝好运


Dui*_*oot 5

在composer.json中尝试以下操作.有明确的编译处理的预更新CMD事件是你的错误,你可能会清除它.

"scripts": {
    "pre-install-cmd": [
        "php artisan clear-compiled"
    ],
    "post-install-cmd": [
        "php artisan optimize"
    ],
    "pre-update-cmd": [
        "php artisan clear-compiled"
    ],
    "post-update-cmd": [
        "php artisan optimize"
    ]
},
Run Code Online (Sandbox Code Playgroud)

尝试再次运行以下命令:

 php composer.phar update
Run Code Online (Sandbox Code Playgroud)


小智 5

为我工作:

根据升级指南更新composer.json后,获取所有更新的存储库:

composer update --no-scripts

然后:composer dump-autoload -o

然后,我再次运行更新,以便我的更新前/更新后脚本可以运行:composer update

应用程序在浏览器中加载,并且我使用 5.2 再次通过了所有测试。希望这可以帮助。