Question

I've deployed a Laravel 4 app to a shared host for the first time and run composer install, but it fails with the message:

Script php artisan clear-compiled handling the post-install-cmd event returned with an error

    [RuntimeException]
    Error Output:

        [InvalidArgumentException]
        Command "clear-compiled" is not defined.

When I run the command php artisan list I don't get the expected list of artisan commands, only:

Available commands:
    help              Displays help for a command
    list              Lists commands
    workbench         Create a new package workbench

All the dependency files are properly installed in the vendor folder.

Why are Laravel's standard artisan commands not available?

Was it helpful?

Solution

The problem was that the php command on my host machine was not running the CLI version of php. When I run the command php-cli artisan list then I get the expected list of Laravel artisan commands.

To get composer to call this properly, then, I just had to update the 'scripts' section in my composer.json to use php-cli instead of plain php.

(As a side note, composer had been spitting out a similar warning with this message: Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top