1

When I push the code to Github it automatically builds it and start the application on AWS through CodeDeploy with a application_start.sh script file that has the following code:

#!/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 exit code is "File or Directory Not Found"

I have a nother script that runs before the application_start.sh that installs node, I tried installing a more stable version with nvm install --lt but it did not change anything even the node verison

Isaak
  • 21
  • 1
  • 6
  • I did run: "nvm use --delete-prefix v19.1.0 --silent" but nothing changed – Isaak Nov 30 '22 at 08:06
  • That's a pretty common error when you mix an Enterprise Linux with community binaries. You'll need to compile everything yourself, or change your OS. – Fravadona Nov 30 '22 at 08:45
  • I tried to modify the node version but it did not work I believe that some changes need to be in the script files: this is the before_install.sh file content #!/bin/bash #download node and npm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash . ~/.nvm/nvm.sh #it used to be nvm install node and I changed it to nvm install --lts as written bellow nvm install --lts #create our working directory if it doesnt exist DIR="/directory/backend" if [ -d "$DIR" ]; then echo "${DIR} exists" else echo "Creating ${DIR} directory" sudo mkdir ${DIR} fi – Isaak Nov 30 '22 at 09:36

1 Answers1

1

The only solution to this is to change the Operating System, Amazon Linux 2 does not upgrade those libraries to the latest version. Changing the OS was also suggested by the Amazon Support team check out this article where I described in detail what happened.

Isaak
  • 21
  • 1
  • 6