Deploying laravel 5 with AWS EB cli: UnexpectedVal

2020-05-06 11:01发布

问题:

So I was just about to deploy some changes for the first time in some months, and I get this error back:

  [UnexpectedValueException]                                                  
  Could not parse version constraint ^1.2.2: Invalid version string "^1.2.2" 

After some digging, I found the line in my composer.lock file:

{
    "_readme": [
        ...
    ],
    "hash": "NotTellingYou",
    "packages": [
        {
         ...
        },
         ....
        "require": {
                "nikic/php-parser": "^1.2.2",
                "php": ">=5.3.3",
                "symfony/console": "~2.1",
                "symfony/filesystem": "~2.1",
                "symfony/finder": "~2.1"
            },

But ehhh... How do I make the string the "correct" then? I know the newest version is 1.3, but is it okay for me to change that? Shouldn't it be automatic when running composer update?

回答1:

change "nikic/php-parser": "^1.2.2" to "nikic/php-parser": "1.*",



回答2:

Update the Composer version you are using. The feature of using the ^ operator has been added in December 2014, so everyone should have gotten an updated copy of Composer by now

composer self-update

This is the key to prevent incompatibility issues. Note that Composer is still in development, and there are some alpha releases. Using it means to also update it regularly.