当我将代码推送到Github时,它会自动构建代码,并通过CodeDeploy在AWS上使用application_start.sh脚本文件启动应用程序,该脚本文件包含以下代码:
#!/bin/bash
#give permission for everything in the express-app directory
sudo chmod -R 777 /directory/backend
#navigate into our working directory where we have all our files OR exit
cd /directory/backend || exit
#add npm and node to path
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # loads nvm bash_completion
#install node modules
npm install
npm install pm2@latest -g
#pm2 stop all
pm2 stop backend
pm2 start ecosystem.config.js --env prodaws
This is the error it shows
127退出代码为“找不到文件或目录”
我有另一个脚本在安装节点的application_start.sh之前运行,我尝试使用nvm install --lt
安装更稳定的版本,但它没有更改任何内容,甚至节点版本也没有更改
1条答案
按热度按时间ioekq8ef1#
唯一的解决方案是改变操作系统,Amazon Linux 2不会将这些库升级到最新版本。改变操作系统也是Amazon支持团队建议的,请查看这个article,我在那里详细描述了发生的事情。