node.js - AWS Elasticbeanstalk 在 PHP 实例类型中安装 Node 和 npm

标签 node.js amazon-web-services npm amazon-elastic-beanstalk

我有一个使用 gulp 构建生产文件的 PHP 应用程序,我正在使用 elasticbeanstalk 将我的应用程序部署到 AWS EC2 实例,我想安装 Node 和 npm 以在部署期间运行 gulp,我当前的配置是:

01-installPackages.config inside .ebextenstions 文件夹

commands:
  01updateComposer:
    command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update
  02installNode:
    command:
      # run this command from /tmp directory
      cwd: /tmp
      # don't run the command if node is already installed (file /usr/bin/node exists)
      test: '[ ! -f /usr/bin/node ] && echo "node not installed"'
      # install from epel repository
      # flag -y for no-interaction installation
      command: 'sudo yum install -y nodejs --enablerepo=epel'

Node 命令失败但如果我 ssh 进入并运行该命令 Node 已安装

知道我的配置有什么问题吗?

谢谢!

最佳答案

当前的答案如下:

commands:
  01enable_epel:
    command: sudo amazon-linux-extras install epel
  02npm_install:
    command: sudo yum -y --enablerepo=epel install nodejs npm

使用 extras 库记录 in AWS docs

关于node.js - AWS Elasticbeanstalk 在 PHP 实例类型中安装 Node 和 npm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32765875/

相关文章:

amazon-web-services - Elastic Beanstalk CLI,如何使用RDS实例创建环境?

amazon-web-services - 暂时禁用 AWS 自动扩展组事件

maven - NetBeans 无法在 Maven Web 应用程序上运行 package.json

javascript - 将 nodejs 模块移植到 React Native : Object. 原型(prototype)未定义

node.js - 如何从 AWS lambda 发布到 Node.js 中的云观察指标

JavaScript导入HTML文件内容(目标是浏览器)

javascript - npm start 是如何工作的,应该是 npm run start 吧? (创建 react 应用程序)

node.js - 如何使用 get 库从给定的 url 下载文件到缓冲区?

android - AWS Cognito 用户池和 Facebook 集成

javascript - 停止在其他机器上实时重新加载 React 应用程序