我使用AWS Documentation在我的ec2实例中设置了npm。 安装后,我确认已安装npm-
npm -v
输出:
6.4.1
我正在使用CodeDeploy部署nodejs,并且在我的AppSpec.yml
-
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