本文介绍了无法在 CircleCi 2.0 上安装 ffmpeg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Ruby on Rails 项目,它使用 CircleCi 运行测试.过去我使用的是 CircleCi 1.0,但现在我迁移到了 CircleCi 2.0.我在安装 ffmpeg 时遇到问题.CircleCi 2.0 使用 Ubuntu 14.04.我这样安装ffmpeg:

I have Ruby on Rails project which uses CircleCi to run tests. In the past I was using CircleCi 1.0 but now I migrated to CircleCi 2.0. I have problem with installing ffmpeg. CircleCi 2.0 uses Ubuntu 14.04. I install ffmpeg like this:

# ffmpeg installation
sudo add-apt-repository ppa:mc3man/trusty-media -y
sudo apt-get update
sudo apt-get install ffmpeg

我的 circle.yml 配置文件如下所示:

and my circle.yml config file looks like this:

version: 2
environment:
  TZ: "/usr/share/zoneinfo/America/Los_Angeles"

jobs:
  build:
    parallelism: 2
    working_directory: ~/circleci-survey-builder
    docker:
      - image: circleci/ruby:2.4.1-node
        environment:
          PGHOST: 127.0.0.1
          PGUSER: ubuntu
          RAILS_ENV: test
      - image: circleci/postgres:9.6-alpine
        environment:
          POSTGRES_USER: ubuntu
          POSTGRES_DB: circle_test
          POSTGRES_PASSWORD: ''
    steps:
      - checkout

      - run:
          name: 'Install CircleCI dependencies'
          command: bash deploy/circle-dependencies.sh

      - type: cache-restore
        key: dashboard-{{ checksum "Gemfile.lock" }}

      - run:
          name: 'Install gems'
          command: bundle install --path vendor/bundle

      - type: cache-save
        key: dashboard-{{ checksum "Gemfile.lock" }}
        paths:
          - vendor/bundle

      - run:
          name: 'Install postgresql-client'
          command: sudo apt install postgresql-client

      - run:
          name: 'Create database.yml'
          command: mv config/database.ci.yml config/database.yml

      - run:
          name: Set up SurveyBuilder database
          command: bundle exec rake db:structure:load --trace

      - run:
          name: 'Run tests'
          command: |
            bundle exec rspec spec

当我在 CircleCi 上运行构建时,它返回以下错误:

It returns following error when I run build on CircleCi:

#!/bin/bash -eo pipefail
bash deploy/circle-dependencies.sh

Fetching: bundler-1.16.0.gem (100%)
Successfully installed bundler-1.16.0
1 gem installed
sudo: add-apt-repository: command not found


Ign http://deb.debian.org jessie InRelease

Get:1 http://deb.debian.org jessie-updates InRelease [145 kB]

10% [1 InRelease 13.8 kB/145 kB 10%] [Waiting for headers] [Connecting to securHit http://deb.debian.org jessie Release.gpg

Hit http://deb.debian.org jessie Release

Get:2 http://deb.debian.org jessie-updates/main amd64 Packages [23.2 kB]

Get:3 http://deb.debian.org jessie/main amd64 Packages [9063 kB]

Get:4 http://security.debian.org jessie/updates InRelease [63.1 kB]

Get:5 http://security.debian.org jessie/updates/main amd64 Packages [610 kB]

100% [3 Packages 9063 kB]100% [3 Packages 9063 kB]Fetched 9904 kB in 1s (8178 kB/s)

Reading package lists... 1%
Reading package lists... 61%
Reading package lists... Done


Reading package lists... 1%
Reading package lists... Done


Building dependency tree... 0%
Building dependency tree


Reading state information... Done

Package ffmpeg is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'ffmpeg' has no installation candidate
Exited with code 100

我该如何解决这个问题?

How can I fix that?

推荐答案

由于系统现在是 Debian 8.0 (jessie) 而不是 Ubuntu 14.04.您需要启用反向移植

Since the system is now Debian 8.0 (jessie) and not Ubuntu 14.04. You need to enable backports

sudo sh -c 'echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list'
apt update
apt install -y ffmpeg

这篇关于无法在 CircleCi 2.0 上安装 ffmpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-19 15:06