Install npm package globally on AWS Elastic Beanstalk

I am trying to install an npm package all over the world on a resilient beanstalk. This is what my config file looks like as I wrote based on this documentation .

container_commands:
  install_phantom:
    command: "npm install phantomjs -g"

      

And when I deploy to Elastic Beanstalk I get this error

Instance command error. Return code: 1 Exit: An error occurred during build: The install_phantom command failed.

+4


source to share


2 answers


Based on the answer here you have tried:



container_commands:
  install_phantom:
    command: "export PATH=$PATH; npm install phantomjs -g"

      

+2


source


The environment variable for installing node is NODE_HOME, so you have to do this to run npm or node in a container command in your config files:



container_commands:
  install_phantom:
    command: bash -c "PATH=$PATH:$NODE_HOME/bin npm install phantomjs -g"

      

0


source







All Articles