2

I want to run the command node /home/makerio/Projects/red.js when my computer boots. I added the command to startup apps but it gave me an error that indicates that for some reson, it was running an older version of nodejs

makerio
  • 39

1 Answers1

3

An alternative solution would be to use pm2.

Quoting from its README

PM2 is a production process manager for Node.js applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks

Basically it starts and manages the node process, at boot time or when the node process/app exists/breaks

# Installing pm2    
npm install -g pm2 # may require sudo

Starting the app

pm2 start ~/Projects/red.js pm2 save # saves the running processes # if not saved, pm2 will forget # the running apps on next boot

check status

pm2 list

IMPORTANT: If you want pm2 to start on system boot

pm2 startup # starts pm2 on computer boot

As for having an outdated node version, many guides exist such as this one

Saikub
  • 54