Amazon Elastic Beanstalk node and npm non-standard install locations

后端 未结 5 480
遥遥无期
遥遥无期 2021-01-30 01:41

Amazon Beanstalk installs node and npm into really obscure places - and I\'m not sure they won\'t change if EB decides to use a newer version of node, which would cause my appli

5条回答
  •  -上瘾入骨i
    2021-01-30 02:24

    We had a similar issue with "node not found", trying to run node in container commands. After running ps aux on the EC2 instance we saw that EB has access to the $NODE_HOME env var:

    su -s /bin/sh -c PATH=$PATH:$NODE_HOME/bin $EB_NODE_COMMAND 2>&1 nodejs
    

    This can be used in .ebextensions, e.g.:

    container_commands:
      your_node_script:
        command: 'env PATH="$PATH:$NODE_HOME/bin" ./bin/your_node_script'
    

    (thanks to Alan Grow)

提交回复
热议问题