脚本 php artisan 清除编译处理返回的预更新-cmd 事件并返回错误(Laravel 4.1 升级)



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

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]

我只需要:

"require": {
        "laravel/framework": "4.1.*",
        "way/generators": "2.*",
        "madewithlove/laravel-oauth2": "0.4.*"
    },

另外,我在错误之前收到了这个(即使我在我的环境中运行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

编辑:

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"
        ]
    },

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

composer install --no-scripts

您是否遵循了升级过程?运行composer update是不够的。laravel.com/docs/upgrade

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

然后尝试composer update,它应该可以工作。

祝你好运

在你的 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"
    ]
},

尝试再次运行以下命令:

 php composer.phar update

为我工作:

更新 composer.jsonper 升级指南后,要获取所有更新的存储库,请执行以下操作:

composer update --no-scripts

然后: composer dump-autoload -o

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

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

如果使用laravel 5,那么正确的删除文件services.json bootstrap/cache文件夹中,这个错误是在作曲家因未完成的更新而损坏时引起的,

如果其他答案都不起作用,请尝试以下操作:

"pre-update-cmd": [],
"post-update-cmd": [
    "php artisan clear-compiled",
    "php artisan optimize"
],

相关内容

  • 没有找到相关文章

最新更新