# Problem with Exec

**URL:** https://discourse.nodered.org/t/problem-with-exec/93951
**Category:** General
**Created:** [17 December 2024 08:39 UTC](https://discourse.nodered.org/t/problem-with-exec/93951 "2024-12-17T08:39:40Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Relo](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@Relo](https://discourse.nodered.org/u/Relo)
#### Post date: [17 December 2024 08:39 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/1 "2024-12-17T08:39:40Z")

</div>

Hi, I'm using the exec node in Node-RED. I want to play a sound clip when I give input to the exec node. When I run the command manually via the command line in Putty, everything works fine. However, when I run the same command in the exec node, nothing happens. There are no error messages, and in debug 3, it shows 'code 0'.

What could be wrong?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/b/2b1282588b8f02b6028459d91f758d799c8dc0ab.png)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [17 December 2024 08:43 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/2 "2024-12-17T08:43:34Z")

</div>

This is tricky.

I've checked on one of my machines and it can be done.

Could you open the `exec` node and screenshot what you have there?

---

<div class="post-metadata">

### Author: ![Relo](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@Relo](https://discourse.nodered.org/u/Relo)
#### Post date: [17 December 2024 08:53 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/3 "2024-12-17T08:53:28Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/8/e873e69dd8dbfc821f8a605325b89259e1c6c9de.png)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [17 December 2024 08:56 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/4 "2024-12-17T08:56:34Z")

</div>

Ok, pretty much the same as I have.

So you connect to the remote machine via Putty and you enter `mpg123 /home/louis/Music/hoho1.mp3` and you hear the sound?

Sorry, I just want to be sure.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [17 December 2024 09:02 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/5 "2024-12-17T09:02:15Z")

</div>

I think there is a problem with the path.

You need to _enable_ your `public` thing in the settings file for node-red

so the sound file has to be in that directory.

eg: from my working one.  
(This is in a `template` node to build the message)  
`/home/pi/.node-red/public/Sounds/{{payload}}`  
and my `exec` node uses the `payload`

(settings file change needed)

```auto
    // When httpAdminRoot is used to move the UI to a different root path, the
    // following property can be used to identify a directory of static content
    // that should be served at http://localhost:1880/.
    //httpStatic: '/home/nol/node-red-static/',
    httpStatic: '/home/pi/.node-red/public', // <-- this line here
    //httpStatic: '/home/pi',

```

Hope that helps.

---

<div class="post-metadata">

### Author: ![Relo](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@Relo](https://discourse.nodered.org/u/Relo)
#### Post date: [17 December 2024 09:10 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/6 "2024-12-17T09:10:52Z")

</div>

Yes I do it and it works in Putty

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [17 December 2024 09:14 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/7 "2024-12-17T09:14:12Z")

</div>

See my last post.

I really suspect that is the problem.

Something to do with permissions.

The file to be played has to be in the declared `public` directory - as set in the `settings.js` file in the `.node-red` directory.

So you will have to make a directory in `.node-red` called `public` (or `Public` if you want) then you put the sound file in that directory.

OR you add a sub-directory for sounds, and put the file in that one.

Sorry I can't be more helpful, it is near my limits of help.  
So the command would be more like:  
`mpg123 /home/pi/louis/.node-red/public/sound/hoho1.mp3`

**AND** you will have to restart node-red to get it working.

---

<div class="post-metadata">

### Author: ![Relo](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@Relo](https://discourse.nodered.org/u/Relo)
#### Post date: [17 December 2024 09:33 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/8 "2024-12-17T09:33:05Z")

</div>

> [@Trying\_to\_learn](#):
>
> `mpg123 /home/pi/louis/.node-red/public/sound/hoho1.mp3`

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/6/067413ebc01b8c8c2adb2273f6fb6f8e65640a3f.png)  
It does it in Putty but not in Node-red.  
The difference is that I don't have the pi folder I think.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [17 December 2024 09:34 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/9 "2024-12-17T09:34:16Z")

</div>

Sorry, my mistake.

Where I have `pi` you will have `louis`.

Try that.

**Don't forget to edit the `settings.js` file too** and restart `node-red``.

---

<div class="post-metadata">

### Author: ![Relo](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@Relo](https://discourse.nodered.org/u/Relo)
#### Post date: [17 December 2024 09:40 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/10 "2024-12-17T09:40:39Z")

</div>

I don't understand what to do with the settings.js

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [17 December 2024 09:42 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/11 "2024-12-17T09:42:46Z")

</div>

You need to edit it.

Find the line with `httpStatic` in it and set the path - as shown, but change `pi` to `louis`

Then make the directory `public` in the `.node-red` directory.

---

<div class="post-metadata">

### Author: ![Relo](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@Relo](https://discourse.nodered.org/u/Relo)
#### Post date: [17 December 2024 09:51 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/12 "2024-12-17T09:51:54Z")

</div>

I work directly with a mouse and keyboard on the Raspberry Pi. I see the `settings.js` file located in the `/home/louis/.nodered` folder.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [17 December 2024 09:52 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/13 "2024-12-17T09:52:10Z")

</div>

Please set the debug nodes to Output Complete Message and show us the output for each of them.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [17 December 2024 09:54 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/14 "2024-12-17T09:54:56Z")

</div>

I'm confused.

> I work directly with a mouse and keyboard on the Raspberry Pi.

So why do you need to use `putty` to get to it?

First off:

```auto
mkdir public

```

Then edit the `settings.js` file.  
eg:  
`nano settings.js`  
Then scroll down and find the line `httpStatic`  
Change the line and save.  
then put a copy of the file you want to play in that directory.

---

<div class="post-metadata">

### Author: ![Relo](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@Relo](https://discourse.nodered.org/u/Relo)
#### Post date: [17 December 2024 10:04 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/15 "2024-12-17T10:04:59Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/c/6c879d938510a2e2a61b06d817a9fd7bad094c53.png)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [17 December 2024 10:05 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/16 "2024-12-17T10:05:50Z")

</div>

Ok, but you will need to remove the two leading `//` as they make the line a comment.

And have another look at the path.

Then look at what I posted.

There **IS** a difference - beyond the `pi/louis` part.

Ok, looking at the other lines, I may be wrong.

THIS IS NOW BEYOND MY KNOWLEDGE BASE.

---

<div class="post-metadata">

### Author: ![Relo](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@Relo](https://discourse.nodered.org/u/Relo)
#### Post date: [17 December 2024 10:12 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/17 "2024-12-17T10:12:35Z")

</div>

Just to be sure

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/1/c12b81075f884f13fd48dba7daff4d9053defd17.png)

---

<div class="post-metadata">

### Author: ![Relo](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@Relo](https://discourse.nodered.org/u/Relo)
#### Post date: [17 December 2024 10:17 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/18 "2024-12-17T10:17:33Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/0/d0456a59d3cf61b927ec8e23532a05fbdbdc8f0d.jpeg)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [17 December 2024 10:20 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/19 "2024-12-17T10:20:24Z")

</div>

THIS IS NOW BEYOND MY KNOWLEDGE BASE.

Sorry.

---

<div class="post-metadata">

### Author: ![Relo](https://avatars.discourse-cdn.com/v4/letter/r/71e660/32.png) [@Relo](https://discourse.nodered.org/u/Relo)
#### Post date: [17 December 2024 10:21 UTC](https://discourse.nodered.org/t/problem-with-exec/93951/20 "2024-12-17T10:21:49Z")

</div>

I am making a kind of Steady Hand Game with a Siemens Logo. When the spiral is touched, a buzzer sounds, which is controlled by the Logo. At the end of the game, the ring makes contact with a separate input on the Logo.

After that, a hoho.mp3 sound clip should play.  
I already tried this with the 'Audio Out' in Node-RED, but it played through my PC speakers instead of the Raspberry Pi.  
I’m almost at my wit’s end, and I’m not very experienced with programming in Putty yet.

[Next page](https://discourse.nodered.org/t/problem-with-exec/93951.md?page=2)
