【问题标题】:How to make Elastic Beanstalk uses Yarn instead of NPM in Amazon Linux 2如何使 Elastic Beanstalk 在 Amazon Linux 2 中使用 Yarn 而不是 NPM
【发布时间】:2020-12-16 06:07:44
【问题描述】:

经过大量研究,我仍然无法让 EB 使用 Yarn 安装软件包。 以下是我尝试过的一些方法:

  • 通过./ebextensions/options.config 中的命令和container_commands 安装和运行yarn(我收到此错误:构建期间未处理的异常:cfn-init.log 中的命令01_run_yarn 失败)

    这是我的./ebextensions/options.config

        option_settings:
          aws:elasticbeanstalk:application:environment:
            NODE_ENV: production
    
        commands:
          01_install_node:
            command: |
              sudo curl --silent --location https://rpm.nodesource.com/setup_12.x | sudo bash -
              sudo yum -y install nodejs
          02_install_yarn:
            test: '[ ! -f /usr/bin/yarn ] && echo "Yarn not found, installing..."'
            command: |
              sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
              sudo yum -y install yarn
    
        container_commands:
          01_run_yarn:
            command: |
              yarn --production
    
  • 编写脚本以在./platform/hooks/prebuild/yarn.sh 中安装和运行纱线。我关注了this 文章并在eb-engine.log 中得到了权限被拒绝错误

【问题讨论】:

  • 你检查过 EB 日志这个异常/错误信息是什么?
  • 嗨@Marcin,我在我的问题中包含了错误:(

标签: node.js amazon-web-services amazon-elastic-beanstalk yarnpkg


【解决方案1】:

您可以在推送代码之前更改本地权限:

git update-index --chmod=+x .platform/hooks/prebuild/yarn.sh

git commit -am 'message'

【讨论】:

    猜你喜欢
    • 2021-10-29
    • 2016-02-06
    • 2020-07-23
    • 2016-05-25
    • 1970-01-01
    • 2020-11-08
    • 2021-01-12
    • 2022-07-23
    • 2020-11-02
    相关资源
    最近更新 更多