aaemnnosttv/wp-cli-dotenv-command

Fatal after installation

jrmlstf opened this issue · 6 comments

I got a fatal error after installation :

→ wp

Fatal error: Cannot redeclare class Spyc in /Users/me/.wp-cli/vendor/mustangostang/spyc/Spyc.php on line 57

Using

→ wp cli info
PHP binary: /usr/bin/php
PHP version:    5.5.29
php.ini used:   
WP-CLI root dir:    phar://wp-cli.phar
WP-CLI global config:   /Users/me/.wp-cli/config.yml
WP-CLI project config:  
WP-CLI version: 0.22.0

Any idea ?

Thanks guys

That's strange. The command doesn't require in any dependencies nor does it use any class by that name. Care to share your .wp-cli/composer.json ?

Here is my ~/.wp-cli/composer.json :

{
    "minimum-stability": "dev",
    "require": {
        "sinebridge/wp-cli-about": "dev-master",
        "aaemnnosttv/wp-cli-dotenv-command": "^0.1"
    },
    "config": {
        "bin-dir": "bin",
        "vendor-dir": "vendor"
    },
    "repositories": {
        "wp-cli": {
            "type": "composer",
            "url": "http://wp-cli.org/package-index/"
        }
    }
}

And my config.yml :

require:
 - vendor/autoload.php
 - commands/about/about.php

I have to remove - vendor/autoload.php from the config to make the wp command working again.

I think the problem is that you're just double-requiring the about command since before you didn't have the vendor/autoload.php in your config.yml.

The about command autoloads its own about.php from it's composer.json file.

Try changing your config to this:

require:
 - vendor/autoload.php

I just tried, same error.

After digging a bit more, it seems this is a problem with the sinebridge/wp-cli-about command.

See the docs about installing via Composer.

I get the same error you see when installing only this command via composer, and requiring the autoloader in the config.yml. The problem is that the about command requires wp-cli/wp-cli as a dependency, which is really unnecessary.

So, I feel your pain, but it really doesn't have anything to do with this package. It's also worth noting that the about command repo hasn't been touched in 2+ years.

Unfortunately, this command is designed to be installed via Composer, so I'm not sure that these two can coexist.

Wish I could be of more help, but it's out of my hands.

Ok, thanks for you help @aaemnnosttv