Systemctl configuration on AWS EC2 + AWS Linux2
I am trying to automate nodebb bring-up. I am using Amazon's EC2 with linux2.
Per the manual, my systemctl is as follows:
After=system.slice multi-user.target mongod.service
ExecStart=/usr/bin/env node loader.js --no-silent --no-daemon
My first issue was that node was not found (the recommended nodejs setup is per-user and not global). I solved that by adding a link (ln -s) from the www directory to the latest node version, replacing the ExecStart with:
ExecStart=/usr/bin/env /home/nodebb/www/node_link loader.js --no-silent --no-daemon
NodeBB does start, however, it looks like the WorkingDirectory is not respected, as I am getting spawn npm ENOENT when attempting to install a plugin.
Any idea how to fix this?
@jjsagan spawn npm enoent means that npm isn't in your path when your start the NodeBB process.
Thank you @PitaJ , the same issue I had with node.
The paths to npm and node are dynamic, as they depend on the last version installed. I rely on .bashrc to set the path properly.
Is there a way in systemctl to source the path from the .bashrc of a user ("nodebb" in my case), prior to execution?
I figured it out @PitaJ
arranka last edited by
What is the manual that you use?