【问题标题】:bower install with beanstalk用豆茎安装凉亭
【发布时间】:2017-11-10 19:01:03
【问题描述】:

我正在使用 beanstalk 在 aws ec2 上进行部署。 我的项目使用 bower 来管理库的依赖关系。 (但我项目的主要语言是python-flask。)

据我所知,我可以通过 .ebextensions 配置安装其他软件包。 我用它安装了redis。

packages: 
  yum:
    gcc-c++: [] 
    make: []
sources:
  /home/ec2-user: http://download.redis.io/releases/redis-2.8.4.tar.gz
commands:
  redis_build:
    command: make
    cwd: /home/ec2-user/redis-2.8.4
  redis_config_001:
    command: sed -i -e "s/daemonize no/daemonize yes/" redis.conf
    cwd: /home/ec2-user/redis-2.8.4
  redis_config_002:
    command: sed -i -e "s/# maxmemory <bytes>/maxmemory 500MB/" redis.conf
    cwd: /home/ec2-user/redis-2.8.4
  redis_config_003:
    command: sed -i -e "s/# maxmemory-policy volatile-lru/maxmemory-policy allkeys-lru/" redis.conf
    cwd: /home/ec2-user/redis-2.8.4
  redis_server:
    command: src/redis-server redis].conf
    cwd: /home/ec2-user/redis-2.8.4

我添加了 npm 和 bower,但它不起作用。

packages: 
  yum:
    gcc-c++: [] 
    make: []
sources:
  /home/ec2-user: http://download.redis.io/releases/redis-2.8.4.tar.gz
commands:
  redis_build:
    command: make
    cwd: /home/ec2-user/redis-2.8.4
  redis_config_001:
    command: sed -i -e "s/daemonize no/daemonize yes/" redis.conf
    cwd: /home/ec2-user/redis-2.8.4
  redis_config_002:
    command: sed -i -e "s/# maxmemory <bytes>/maxmemory 500MB/" redis.conf
    cwd: /home/ec2-user/redis-2.8.4
  redis_config_003:
    command: sed -i -e "s/# maxmemory-policy volatile-lru/maxmemory-policy allkeys-lru/" redis.conf
    cwd: /home/ec2-user/redis-2.8.4
  redis_server:
    command: src/redis-server redis].conf
    cwd: /home/ec2-user/redis-2.8.4
  npm_install:
    command: "yum install -y npm"
  bower_install:
    command: "npm install -g bower"
  bower_install_packages:
    command: bower install

我总是面临这样的错误。

Upload Complete.
INFO: Environment update is starting.                               
INFO: Deploying new version to instance(s).                         
ERROR: [Instance: i-41397fb2 Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: [CMD-AppDeploy/AppDeployStage0/EbExtensionPreBuild] command failed with error code 1: Error occurred during build: Command bower_install failed.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].

我该如何解决这个问题?

【问题讨论】:

标签: amazon-web-services bower amazon-elastic-beanstalk


【解决方案1】:

https://gist.github.com/growingdever/8eb2ae8e5793b9c1cd09

我通过上面的配置解决了这个问题。 (那个配置是​​我写的。)

【讨论】:

【解决方案2】:

我也遇到了这个问题,最后 AWS 支持为我解决了这个问题。 分辨率为:

1) 将以下脚本添加到 .ebestensions:

container_commands:
  01_bower_install:
    command: "export PATH=$PATH; $NODE_HOME/bin/node ./node_modules/bowe/bin/bower -V install --allow-root -F > /tmp/01_bower_install.log"

2) 将以下行添加到 package.json(在脚本元素中)

"scripts": {
  "postInstall": "bower install"
},

就是这样

【讨论】:

  • 但是……为什么? “仅此而已”,前提是您不介意盲目地复制粘贴代码。
猜你喜欢
  • 2013-07-03
  • 2015-03-30
  • 2023-03-07
  • 2014-02-09
  • 2013-05-23
  • 2017-03-14
  • 2014-08-08
  • 2016-01-09
  • 2016-06-13
相关资源
最近更新 更多