Loourr
Loourr

Reputation: 5125

Install npm package globally on AWS Elastic Beanstalk

I'm trying to install an npm package globally on elastic beanstalk. This is what my config file looks like which 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

Command failed on instance. Return code: 1 Output: Error occurred during build: Command install_phantom failed .

Upvotes: 5

Views: 3912

Answers (2)

zakum1
zakum1

Reputation: 1112

The environment variable for the node installation is NODE_HOME, so you should 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"

Upvotes: 0

Francis Eytan Dortort
Francis Eytan Dortort

Reputation: 1447

Based on the answer given here, have you tried:

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

Upvotes: 2

Related Questions