Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Elasticbeanstalk install node and npm in PHP instance type

I've got a PHP application that uses gulp to build the production files, I'm using elasticbeanstalk to deploy my app to and AWS EC2 instance and I want to install node and npm to run gulp during the deploy, my current configuration is:

01-installPackages.config inside .ebextenstions folder

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'

the node commands fails but if I ssh in and i run that command node is installed

any idea of what's wrong with my configuration?

Thanks!

like image 257
Matteo Hertel Avatar asked Sep 24 '15 15:09

Matteo Hertel


1 Answers

The current answer for this is the following:

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

using the extras library documented in AWS docs

like image 148
MTH Avatar answered Oct 06 '22 00:10

MTH