node.jsshellaws-code-deploylts

/lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)


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


Solution

  • 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.