【问题标题】:Building failing at Travis-CI due to composer command call由于作曲家命令调用,在 Travis-CI 构建失败
【发布时间】:2016-07-01 10:10:17
【问题描述】:

我正在尝试在Travis-CI 构建我的 PHP 项目,但是当他尝试执行 composer 命令时我遇到了错误。我在 Travis-CI 的项目的构建日志:

Using worker: worker-linux-docker-c22a70ed.prod.travis-ci.org:travis-linux-3

Build system information
Build language: ruby
Build image provisioning date and time
Thu Feb  5 15:09:33 UTC 2015
Operating System Details
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise
Linux Version
3.13.0-29-generic
Cookbooks Version
a68419e https://github.com/travis-ci/travis-cookbooks/tree/a68419e
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

LLVM version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Pre-installed Ruby versions
ruby-1.9.3-p551
Pre-installed Node.js versions
v0.10.36
Pre-installed Go versions
1.4.1
Redis version
redis-server 2.8.19
riak version
2.0.2
MongoDB version
MongoDB 2.4.12
CouchDB version
couchdb 1.6.1
Neo4j version
1.9.4
RabbitMQ Version
3.4.3
ElasticSearch version
1.4.0
Installed Sphinx versions
2.0.10
2.1.9
2.2.6
Default Sphinx version
2.2.6
Installed Firefox version
firefox 31.0esr
PhantomJS version
1.9.8
ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/local/maven
Java version: 1.7.0_76, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.13.0-29-generic", arch: "amd64", family: "unix"

$ git clone --depth=50 --branch=master git://github.com/rgiaviti/laravel-correios-track.git rgiaviti/laravel-correios-track
Cloning into 'rgiaviti/laravel-correios-track'...
remote: Counting objects: 69, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 69 (delta 14), reused 0 (delta 0), pack-reused 20
Receiving objects: 100% (69/69), 11.17 KiB | 0 bytes/s, done.
Resolving deltas: 100% (14/14), done.
Checking connectivity... done.
$ cd rgiaviti/laravel-correios-track
$ git checkout -qf e2c8293aa5a996f5d8bbdef6788e4e2d84c15c1e

This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables.
If you require sudo, add 'sudo: required' to your .travis.yml
See http://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
$ rvm use default
Using /home/travis/.rvm/gems/ruby-1.9.3-p551
$ ruby --version
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
$ rvm --version
rvm 1.26.10 (latest-minor) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$ bundle --version
Bundler version 1.7.6
$ gem --version
2.4.5
$ composer self-update
/home/travis/build.sh: line 41: composer: command not found

The command "composer self-update" failed and exited with 127 during .

Your build has been stopped.

我认为问题出在这里:

$ composer self-update
/home/travis/build.sh: line 41: composer: command not found

我的 .travis.yml 文件:

language: php

php:
  - 5.4
  - 5.5
  - 5.6
  - hhvm
  - hhvm-nightly

before_script:
  - composer self-update
  - composer install --prefer-source --no-interaction --dev

我是 Travis-CI 的新手,我看到的是 composer 未安装或无法正常工作。当我阅读 Travis-CI documentation for PHP projects 时,他们说作曲家可用。

来自文档:

请注意,我们每次更新 PHP 构建时都会更新 composer 环境,即每 30-60 天。因为作曲家有一个 基于时间的更新警告,您可能会看到这样的消息,其中 可以安全地忽略:

Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/home/travis/.phpenv/versions/5.6/bin/composer self-update" to get the latest version.

您还可以将 Composer 包安装到 Travis CI PHP 环境。预先安装了 composer 命令,使用 以下:

composer install

也许我遗漏了一些配置,但我不知道那是什么配置。

【问题讨论】:

  • 根据this comment,这个问题是由于“隐藏字符”造成的,不再重现。建议关闭。

标签: php composer-php travis-ci


【解决方案1】:

这里的问题是您的 构建语言 设置为 ruby - 无论出于何种原因。 ruby 环境没有预先安装 Composer,您的命令失败。

您可以在 Travis 构建日志的前几行找到该条目。

你的composer.json.travis.yml 没问题。 换句话说:您请求了一个带有 Composer 的 PHP 环境。 但特拉维斯没有意识到这一点。 这是一个相当奇怪的问题,也许只是暂时的。

请检查文件权限 - 这是我唯一的猜测。

否则,您可能会决定跳上 IRC 并询问 Travis 人员或提交错误。

【讨论】:

  • 我联系了 Travis-CI 支持,他们检查了我的 .travis.yml 文件。他们告诉我language: php 之前有一个隐藏字符。所以我重新创建了我的.travis.yml,它成功了!
  • 很高兴你解决了它! (他们应该更加强化他们的配置文件解析器并输出解析错误。)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-08-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多