找不到EC2 CodeDeploy npm,即使它对于ec2-user也存在

时间:2018-09-30 21:36:16

标签: node.js amazon-ec2 npm aws-code-deploy

我使用AWS Documentation在我的ec2实例中设置了npm。 安装后,我确认已安装npm-

npm -v

输出:

6.4.1

我正在使用CodeDeploy部署nodejs,并且在我的AppSpec.yml-

中有一个BeforeInstall挂钩。
version: 0.0
os: linux
permissions:
  - object: /
    pattern: "**"
    owner: ec2-user
    group: ec2-user
files:
  - source: /
    destination: /var/apps/<app-name>
hooks:
  BeforeInstall:
    - location: bin/install_dependencies.sh
      timeout: 300
      runas: ec2-user

install_dependencies.sh如下:

#!bin/bash
npm install

现在,当我部署此代码时,部署失败并显示以下错误:

LifecycleEvent - BeforeInstall
Script - bin/install_dependencies.sh
[stderr]/opt/codedeploy-agent/deployment-root/0fa7ac2e-763d-4976-8f84-70935458d26e/d-YUHE1N5LV/deployment-archive/bin/install_dependencies.sh: line 2: npm: command not found

0 个答案:

没有答案