Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Actions pm2: command not found

I am trying to auto-deploy the project and npm commands run perfectly but when it goes to a line where pm2 restarts the specific projects, then actions fails.

GitHub Actions Error:

GitHub Actions Error

GitHub Action .yml file content:

yml file

like image 553
Shahzaib Imran Avatar asked Jul 10 '26 01:07

Shahzaib Imran


1 Answers

NOTE: This solution is applicable only when you are using an NVM to manage node.js versions

The issue is because of the missing symbolic link for the node and the pm2, here are the commands that you can use to create a symbolic link:

sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" "/usr/local/bin/node"

sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/npm" "/usr/local/bin/npm"

sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/pm2" "/usr/local/bin/pm2"
like image 72
Kishor Patidar Avatar answered Jul 13 '26 21:07

Kishor Patidar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!