使用Beanstalk安装Bower

3

我正在使用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].

我应该如何解决这个问题?

寻找相同的问题!你找到任何解决方案了吗? - godimedia
尝试使用这个:@theChinmay https://gist.github.com/growingdever/8eb2ae8e5793b9c1cd09 - JuHong Jung
2个回答

4

1
链接已离线 :-( - Patrick
@Patrick 试试这个。https://gist.github.com/toughrogrammer/8eb2ae8e5793b9c1cd09 - JuHong Jung

1
我也遇到了这个问题,最终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 元素中

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

就这样


但是...为什么?“那就是全部”只有当你不介意盲目地复制粘贴代码时。 - djvg

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接