create a file called start.sh
export NVM_DIR=/rbd/pnpm-volume/$PROJECT_ID/nvm-$PROJECT_ID
if ! ls $NVM_DIR > /dev/null 2>&1
then mkdir $NVM_DIR
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install 14 # Replace with your desired version
rm -rf /app/node_modules
ln -s /rbd/pnpm-volume/$PROJECT_ID/node_modules /app/node_modules
npm install # prevent *.node not found error
fi
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
node server.js # original start command
and replace the original start script
"scripts":{
"start":"bash start.sh"
}
then make sure you replace the last command in start.sh
with your original start command
Also replace 14
iwith your desired version.