Elastic beanstalk:构建期间未处理的异常:[Errno 2]没有这样的文件或目录

时间:2014-02-10 11:16:42

标签: django amazon-web-services amazon-ec2 elastic-beanstalk

当我在EB上部署我的Django应用程序时出现此错误:

2014-02-10 11:04:51,037 [ERROR] Unhandled exception during build: [Errno 2] No such file or directory
Traceback (most recent call last):
  File "/opt/aws/bin/cfn-init", line 122, in <module>
    worklog.build(detail.metadata, configSets)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 117, in build
    Contractor(metadata).build(configSets, self)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 502, in build
    self.run_config(config, worklog)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 511, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/construction.py", line 216, in build
    changes['packages'][manager] = CloudFormationCarpenter._packageTools[manager]().apply(packages, self._auth_config)
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/apt_tool.py", line 48, in apply
    cache_result = ProcessHelper(['apt-cache', '-q', 'gencaches']).call()
  File "/usr/lib/python2.6/site-packages/cfnbootstrap/util.py", line 406, in call
    shell=isinstance(self._cmd, basestring), env=self._env, cwd=self._cwd)
  File "/usr/lib64/python2.6/subprocess.py", line 639, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.6/subprocess.py", line 1228, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

...我不知道为什么以及它正在寻找什么文件或目录!有什么想法吗?

PS。我正在使用Django 1.6.2和Python 2.7

这是我的app.config里面.ebextensions:

packages:
  yum:
    python-devel: []
    libpcap: []
    libpcap-devel: []
    libnet: []
    libnet-devel: []
    pcre: []
    pcre-devel: []
    gcc: []
    gcc-c++: []
    automake: []
    autoconf: []
    libtool: []
    make: []
    libyaml: []
    libyaml-devel: []
    libxml2: []
    libxml2-devel: []
    zlib: []
    zlib-devel: []
    file-devel: []
    postgresql: []
    postgresql-devel: []
    geoip: []
    geoip-devel: []
    graphviz: []
    graphviz-devel: []
  apt:
    binutils: []
    libproj-dev: []
    gdal-bin: []
    python-gdal: []

option_settings:
  "aws:elasticbeanstalk:application:environment":
    DJANGO_SETTINGS_MODULE: "mysettings"
  "aws:elasticbeanstalk:container:python":
    NumProcesses: 10
    NumThreads: 1
  "aws:elasticbeanstalk:container:python:staticfiles":
    "/static/": "static/"

更新

问题是在配置文件中声明的apt包,尽管在其文档亚马逊说它支持apt,但这不是真的,或者至少不适用于标准的Linux AMI 64但是对于Python 2.7! AMI运行Linux Red Hat,它不提供apt,所以我只能依赖于yum。 现在我的问题是弄清楚如何以另一种方式安装我的依赖项,因为该发行版中的yum存储库没有我需要的库。

1 个答案:

答案 0 :(得分:0)

看起来它正在尝试部署到Ubuntu盒子,也许你正在部署的盒子不是Ubuntu? (Elastic Beanstalk通常部署到Amazon Linux映像)

您可以在错误中看到它正在尝试运行仅在Ubuntu上可用的apt-cache命令:

File "/usr/lib/python2.6/site-packages/cfnbootstrap/apt_tool.py", line 48, in apply
cache_result = ProcessHelper(['apt-cache', '-q', 'gencaches']).call()