Reputation: 43479
I'm loading AWS API via composer and getting following error:
[RuntimeException]
Could not load package aws/aws-sdk-php in http://packagist.org: [Unexpected
ValueException] Could not parse version constraint ^5.3: Invalid version st
ring "^5.3"
[UnexpectedValueException]
Could not parse version constraint ^5.3: Invalid version string "^5.3"
Configuration:
{
"name": "RepositoryName",
"homepage": "http://homepage.elasticbeanstalk.com",
"archive": {
"directory": "dist",
"format": "zip",
"skip-dev": false,
"absolute-directory": "/var/www/html/web/dist"
},
"repositories": [
{ "type": "composer", "url": "http://packagist.org" }
],
"require": {
"abeautifulsite/jquery-minicolors": "2.1.6",
"aws/aws-sdk-php": "2.6.*"
},
"require-dependencies": true
}
As you can see I am requesting 2.6.*
version, not ^5.3
. Any ideas how to fix that? Running locally and on AWS same results.
Upvotes: 2
Views: 694
Reputation: 41756
This is a Composer parsing error due to a wrong or unsupported syntax.
The old version of Composer can't handle that ^
operator i think.
Try a composer self-update
first.
composer self-update
..ebextensions\composer.config
commands:
01updateComposer:
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update
option_settings:
- namespace: aws:elasticbeanstalk:application:environment
option_name: COMPOSER_HOME
value: /root
Referencing the Symfony 2 AWS Deployment Guide here, because it contains an example for that file: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP_symfony2.html
And ebextensions guide: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html
I'm using localhost and locally installed Composer. Done
composer self-update
, too
How to install aws-sdk-php with Composer?
If you just want to fetch the aws-sdk package to work with it locally, you might use the following composer.json file as an example:
composer.json
:
{
"name": "my/project-using-aws-package",
"require": {
"abeautifulsite/jquery-minicolors": "2.1.6",
"aws/aws-sdk-php": "2.6.*"
},
"autoload": {
"psr-4": {
"MyApp\\": "app/"
}
}
}
Run: composer install -vvv --profile --prefer-dist -o
.
This will install v2.6.16 of aws-sdk-php package. Please note that this is not the latest version, but i think you defined 2.6.*
intentionally. If not consider raising the version.
Upvotes: 1
Reputation: 11
I ran into this same issue, but I also received the outdate warning:
Warning: This development build of composer is over 30 days old. It is recommended to update it by running "composer.phar self-update" to get the latest version.
So, I ran php composer.phar self-update
Then php composer.phar update
And it worked for me :)
Upvotes: 1