我通过编辑器加载AWS API并收到以下错误:
[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"
配置:
{
"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
}
正如您所看到的,我正在申请2.6.*
版本,而不是^5.3
。任何想法如何解决?在本地和AWS上运行相同的结果。
答案 0 :(得分:1)
由于语法错误或不受支持,这是一个Composer解析错误。
旧版本的Composer无法处理我认为的^
运算符。
首先尝试composer self-update
。
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
在此处引用Symfony 2 AWS部署指南,因为它包含该文件的示例:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP_symfony2.html
ebextensions指南:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html
我正在使用localhost和本地安装的Composer。也完成
composer self-update
如何使用Composer安装 aws-sdk-php ?
如果您只想获取aws-sdk包以在本地使用它, 您可以使用以下composer.json文件作为示例:
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/"
}
}
}
运行:composer install -vvv --profile --prefer-dist -o
。
这将安装aws-sdk-php包的v2.6.16。请注意,这不是最新版本,但我认为您有意定义了2.6.*
。如果不考虑提高版本。
答案 1 :(得分:1)
我遇到了同样的问题,但我也收到了过时的警告:
警告:作曲家的这个开发版本已经超过30天了。建议通过运行" composer.phar self-update"来更新它。获得最新版本。
所以,我跑了php composer.phar self-update
然后php composer.phar update
它对我有用:)