【问题标题】:Install npm package globally on AWS Elastic Beanstalk在 AWS Elastic Beanstalk 上全局安装 npm 包
【发布时间】:2014-10-15 10:51:56
【问题描述】:

我正在尝试在弹性 beantalk 上全局安装一个 npm 包。这就是我根据 documentation 编写的配置文件的样子。

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

当我部署到 Elastic Beanstalk 时出现此错误

命令在实例上失败。返回码:1 输出:发生错误 构建期间:命令 install_phantom 失败。

【问题讨论】:

  • 我发现的一件事是npm 不包含在路径中,而是位于/opt/elasticbeanstalk/node-install/node-v0.10.26-linux-x64/bin/npm
  • Loourr - 你有运气吗?上面的命令我试过了,包括指定npm的确切路径,但是命令总是失败。

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


【解决方案1】:

根据here给出的答案,你试过了吗:

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

【讨论】:

【解决方案2】:

节点安装的环境变量是 NODE_HOME,所以你应该这样做,在你的配置文件中运行 npm 或 node 的容器命令:

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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2016-03-11
  • 2017-03-26
  • 2013-07-08
  • 2016-02-14
  • 2018-07-01
  • 2021-01-07
  • 2015-04-03
  • 2018-05-25
相关资源
最近更新 更多