DEV Community

Discussion on: Run your Node.js application on a headless Raspberry Pi

Collapse
 
bushibot profile image
bushibot

I have hopefully easy question, I was following this to get node app to run background, but it requires a variable and the whole thing seems to fail when deomonizing it.
I'm trying to pass 'node resources/app/main.js --dataPath=$HOME/foundrydata' through PM2 but it seems to break.

Collapse
 
bogdaaamn profile image
Bogdan Covrig

yep, in order to pass node arguments to pm2 you have to use the --node-args argument. like

pm2 start resources/app/main.js --node-args="--dataPath=$HOME/foundrydata" 

Or you can add it in the pm2 JSON file. You can read more in the tutorial or in the pm2 docs.