Travis.ci: "composer requirements could not be resolved" 但一切都在本地工作 (Yii2)

Travis.ci: "composer requirements could not be resolved" but everything works locally (Yii2)

我正在为 Yii2 框架构建一个包。

在本地一切正常:测试是绿色的,composer 安装/更新依赖cies 没有问题(我在几台具有不同开发环境的机器上试过,完全没有问题)。

但是当 travis-ci 尝试构建我的项目时,相同的 composer 命令 returns 出现错误:"Your requirements could not be resolved to an installable set of packages".

Problem 1
    - yiisoft/yii2 2.0.4 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.3 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.2 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.1 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.0 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - Installation request for yiisoft/yii2 2.0.* -> satisfiable by yiisoft/yii2[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4].
Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

这是我的 composer.json 要求:

"require": {
    "php": ">=5.4.0",
    "mobileka/scope-applicator": "1.0.*",
    "yiisoft/yii2": "2.0.*"
},
"require-dev": {
    "phpunit/phpunit": "4.1.*",
    "mockery/mockery": "0.9.3",
    "satooshi/php-coveralls": "0.6.1"
},

让我重复一遍:这在本地有效,甚至其他人也尝试克隆我的存储库,一切正常。

你可以自己试试:https://github.com/mobileka/scope-applicator-yii2

git clone git@github.com:mobileka/scope-applicator-yii2.git && cd scope-applicator-yii2 && composer install.

有其他人遇到过这个问题吗?有解决方案吗?

谢谢。

问题已通过修改.travis.yml文件解决:

before_script:
  - composer self-update
  - composer global require "fxp/composer-asset-plugin:~1.0.0"
  - composer install --prefer-source --no-interaction

缺少全局要求"fxp/composer-asset-plugin:~1.0.0"