【问题标题】:Rails 5.1.6 AWS Elastic Beanstalk Yarn / Node JS IssueRails 5.1.6 AWS Elastic Beanstalk 纱线/节点 JS 问题
【发布时间】:2019-03-16 01:17:06
【问题描述】:

在升级 AWS Ruby 环境版本后出现应用部署问题。

这是我在部署应用程序时收到的错误:

Yarn executable was not detected in the system.
Download Yarn at https://yarnpkg.com/en/docs/install
rake aborted!
Autoprefixer doesn’t support Node v4.6.0. Update it.
/var/app/ondeck/vendor/bundle/gems/autoprefixer-rails-9.1.3/lib/autoprefixer-rails/processor.rb:163:in `runtime' 
....

这是我正在使用的 Elastic Beanstalk 版本。 Puma with Ruby 2.5 running on 64bit Amazon Linux/2.8.4

有什么想法吗?

我已经设置了一个 Elastic Beanstalk 配置文件来安装 Yarn/Node。但似乎没有解决错误。 (在 React on Rails 线程中找到这个)。

container_commands:
  01_node_get:
    cwd: /tmp
    command: 'sudo curl --silent --location https://rpm.nodesource.com/setup_6.x | sudo bash -'
  02_node_install:
    cwd: /tmp
    command: 'sudo yum -y install nodejs'
  03_yarn_get:
    cwd: /tmp
    # don't run the command if yarn is already installed (file /usr/bin/yarn exists)
    test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
    command: 'sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo'
  04_yarn_install:
    cwd: /tmp
    test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
    command: 'sudo yum -y install yarn'

升级到 Rails 5.2。存在同样的问题。尝试在 64 位 Amazon Linux/2.6.0 上运行 Ruby 2.5 的 Puma。同样的问题。

【问题讨论】:

    标签: ruby-on-rails ruby amazon-web-services


    【解决方案1】:

    来自https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-container-commands

    在设置应用程序和 Web 服务器并提取应用程序版本存档之后,但在部署应用程序版本之前运行容器命令。

    改为使用Commands:

    这些命令在设置应用程序和 Web 服务器之前运行,并提取应用程序版本文件。

    例如

    commands:
      01_node_get:
        # run this command from /tmp directory
        cwd: /tmp
        # flag -y for no-interaction installation (visit https://rpm.nodesource.com for latest)
        command: 'curl --silent --location https://rpm.nodesource.com/setup_11.x | sudo bash -'
    
      02_node_install:
        # run this command from /tmp directory
        cwd: /tmp
        command: 'sudo yum -y install nodejs'
    
      03_yarn_get:
        # run this command from /tmp directory
        cwd: /tmp
        # don't run the command if yarn is already installed (file /usr/bin/yarn exists)
        test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
        command: 'sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo'
    
      04_yarn_install:
        # run this command from /tmp directory
        cwd: /tmp
        test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
        command: 'sudo yum -y install yarn'
    

    【讨论】:

      猜你喜欢
      • 2021-07-19
      • 2019-11-22
      • 2017-12-30
      • 2020-08-01
      • 2019-08-11
      • 2014-10-19
      • 1970-01-01
      • 2017-11-04
      • 2020-02-26
      相关资源
      最近更新 更多