Playing MP3 file using Exec node/mpg321, getting an error

I'm able to play sound files from the command line, but get an error 1 from the exec node.

"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!
tcgetattr(): Inappropriate ioctl for device

Directory: /home/pi/Music
Playing MPEG stream from test-of-mpg321_Joanna-standard.mp3 ...
MPEG 2.0 layer III, 48 kbit/s, 22050 Hz mono
Can't find a suitable libao driver. (Is device in use?)"

Turns out, it works fine until I set up node-red as a service, and then the error starts happening.

That will be because the environment in which the service runs is different to the environment when a user is logged on. Possibly a PATH issue or permissions. I don't know enough the subject to say what it might be in this case.

Is the service being run as the same user as when you run it from the command line?

If you login using ssh and try to run from the command line then, does it work?

It works fine at all times if I run from the command line, when I use node-red-pi to start node-red it still works, If I use "sudo systemctl enable nodered.service" then I'm done, it no longer works even if I use "sudo systemctl disable nodered.service" to stop it.

Including when the command line is in an ssh terminal?

yes, It always works fine when I ssh in.

OK, in that case, as I said

That does not stop the service, it just tells it not to run on boot. node-red-stop or
sudo systemctl stop nodered will stop it.

Just saying that once I set it up as a service, mgp321 no longer works, even if I reboot the pi and restart Node-Red manually (after disabling the nodered.service).

I use omxplayer and it works.

Just saying if you are still having problems and are open to alternatives.

I got that to work, sorta, it was cutting off the end of the MP3, I'm using this for announcements in a manufacturing setting, it cuts off the last word or two more often than not. I did get MPG321 to work, I just have to manually start Node-Red after reboots.

That is not good.

You do know the way to make Node-Red auto start?

The whole point of this thread is that if node-red is started as a service then it does not work.

Oh. Sorry.

Just all the posts/replies seem to be concentrating on the music part and not the auto start part.