I’m currently having a problem with my n8n installation on a raspberry pi. For the last 8 months it’s run without any issues as a service via pm2. Just the other day I had an issue with the pi and after a few days was finally able to reboot it (not sure what the issue is).
Since then n8n no longer starts at boot. pm2 list shows nothing listed. I’ve reinstalled both pm2 and n8n.
Currently when I try to start n8n via pm2 I get the following error : “[PM2][ERROR] Script not found: /home/pi/n8n”
I would have expected that to work but I don’t really know a great deal about pm2, What if you run which n8n to get the path then cd into that directory and run the pm2 command from there?
I remember that when I installing node or pm2, sudo had to be used. This caused pm2 to not be able to do anything with the commands. That’s why I switched to a node version manager (nvm) and that solved a lot of problems.
This doesn’t explain your problem and it’s not a 1:1 solution, but it might be a workaround.
Side note: If you install multiple Node versions, you have to make sure that all packages are installed in their respective folders. Managing pm2 over multiple node versions is not recommended. But you can use the ecosysfiles to specify which node version you want to use by specifying the path.
Normally if n8n is installed globally through NPM you would see a path back assuming npm is correctly installed. When I run the command on my little Linux powered Nuc I get the below response back.
jon@nuc:~$ which n8n
/home/jon/.nvm/versions/node/v16.17.0/bin/n8n