I have quite an issue there and I don't understand from where it could be !
In my flow, I have a slider to control the pulseaudio volume in command lines with exec node, and some .mp3 files played with play-sound nodes.
Everything work fine when I launch node-red with the "node-red" command, but when I start it as a service, I can't control volume, and the .mp3 files won't play.
The logs before the start of the flows are the same...
I'm on raspberry pi 3b, and Node-red 3.0.2 and Node.js 19.3.0
Here is a debug message when I try to play .mp3 file with node-red launched as a service
"High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.3.2-1 (2012/03/25). Written and copyrights by Joe Drew,
now maintained by Nanakos Chrysostomos and others.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
tcgetattr(): Inappropriate ioctl for device
Playing MPEG stream from file.mp3 ...
MPEG 1.0 layer III, 192 kbit/s, 44100 Hz joint-stereo
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
Can't find a suitable libao driver. (Is device in use?)"
I don't understand why everything works fine when I don't start node-red as a service...
I think it was the same because I encoutered this issue when I installed node-red with the script for raspberry pi.
I tried to reinstall everything from zero, and I manually added nodejs, npm and node-red to see if it would be better but no !
I'm not sure what all the pieces are in your set-up, but if you expect Node-RED to control the volume on the local machine then running it as a service will present challenges: it's most likely not running with the same user ID and some of the system contexts are also different.