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

前端 未结 6 961
无人共我
无人共我 2020-12-31 06:00

Here is the error I am getting:

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

[RuntimeException]  
Error Output:

up         


        
相关标签:
6条回答
  • 2020-12-31 06:30

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

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

    Apparently it is not quite that easy to install mcrypt.

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

      sudo apt-get install php5-mcrypt
      
    2. Check whether mcrypt has 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.ini is present in PHP's mods-available directory.

      ls /etc/php5/mods-available/mcrypt.ini
      
    5. 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
      
    6. Enable the mod.

      sudo php5enmod mcrypt
      
    7. Restart apache.

      sudo service apache2 restart
      
    8. Check again whether mcrypt is enabled.

      php --ri mcrypt
      

    The final steps were inspired by Vuk Stanković.

    0 讨论(0)
  • 2020-12-31 06:30

    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 dump-autoload
    

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

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

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

    This would re-create just about everything.

    0 讨论(0)
  • 2020-12-31 06:33

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

    sudo apt-get install php5-mcrypt
    

    Then update composer:

    composer update 
    
    0 讨论(0)
  • 2020-12-31 06:38

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

    1) Find xdebug configuration file.

    $ sudo find / -name xdebug.ini
    

    2) Edit file using any text editor.

    $ sudo vi /your_path/xdebug.ini
    

    3) Set xdebug.scream = 0

    4) Reload server

    $ sudo service apache2 reload
    
    0 讨论(0)
  • 2020-12-31 06:56

    It looks like your laravel install did not run correctly and since part of the composer.json runs the php artisan clear-compiled and php artisan optimize if your laravel application is not working then composer will fail.

    Try running your composer update without invoking the Laravel scripts.

    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

    php composer update
    

    again which will run the scripts for you.

    0 讨论(0)
  • 2020-12-31 06:57

    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.

    "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

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

    To clear the composer cache and finally run

    sudo composer install
    

    This should solve the issue.

    0 讨论(0)
提交回复
热议问题