# Exec node path for shell script dependencies

**URL:** <https://discourse.nodered.org/t/exec-node-path-for-shell-script-dependencies/54907>\
**Category:** General\
**Created:** [9 December 2021 05:37 UTC](https://discourse.nodered.org/t/exec-node-path-for-shell-script-dependencies/54907 "2021-12-09T05:37:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![IoTim](https://avatars.discourse-cdn.com/v4/letter/i/58956e/32.png) [@IoTim](https://discourse.nodered.org/u/IoTim)\
**Post date:** [9 December 2021 05:37 UTC](https://discourse.nodered.org/t/exec-node-path-for-shell-script-dependencies/54907/1 "2021-12-09T05:37:50Z")

</div>

Hi! I'm reasonably new to node-red, but really love it. I've run into a problem I'm unsure of how to solve.

In the Exec node I am trying to run a shell script, except I am having problems with a path for a dependency.

My shell script invokes an AWS Video Kinesis producer to capture video on my RPi and send it to AWS. Cool - my command works fine from the terminal.

When I run the same command in the Exec node, I get an erroneous pipeline error for kvssink - which is part of the Kinesis video producer. To get this to work regularly, I set my path for the library dependencies in /etc/profile.d/env.sh

I'm betting node-red needs me to set the path somewhere to these libraries in settings.js somewhere. But would really appreciate some direction.

Oh - and I have the Exec node configured right - because I can trigger other shell scripts that don't have any dependencies.

Any suggestions or direction is much appreciated - and thank you all in advance.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [9 December 2021 06:27 UTC](https://discourse.nodered.org/t/exec-node-path-for-shell-script-dependencies/54907/2 "2021-12-09T06:27:51Z")

</div>

Hi Tim,

Have you restarted Node-Red?

Does your path change show up if you exec **echo $PATH**?

---

<div class="post-metadata">

**Author:** ![IoTim](https://avatars.discourse-cdn.com/v4/letter/i/58956e/32.png) [@IoTim](https://discourse.nodered.org/u/IoTim)\
**Post date:** [9 December 2021 06:47 UTC](https://discourse.nodered.org/t/exec-node-path-for-shell-script-dependencies/54907/3 "2021-12-09T06:47:06Z")

</div>

Hi @jbudd thanks a bunch. Yes, I've restarted Node-Red. The path to the libraries are not showing up when I echo $PATH. Hmmm.

I'm setting the path to the library with

export LD\_LIBRARY\_PATH="$PATH:/home/pi/amazon-kinesis-video-streams-producer-sdk-cpp/open-source/local/lib"

should it be showing up with I exec echo $PATH?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [9 December 2021 06:59 UTC](https://discourse.nodered.org/t/exec-node-path-for-shell-script-dependencies/54907/4 "2021-12-09T06:59:29Z")

</div>

No, I just assumed that you were setting $PATH.

What happens if you set LD\_LIBRARY\_PATH in the shell script?

---

<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:** [9 December 2021 07:14 UTC](https://discourse.nodered.org/t/exec-node-path-for-shell-script-dependencies/54907/5 "2021-12-09T07:14:17Z")

</div>

In the exec node try  
`LD_LIBRARY_PATH="$PATH:/home/pi/amazon-kinesis-video-streams-producer-sdk-cpp/open-source/local/lib" /path/to/ script`

That sets the env var and runs the script. Though I am not sure about the $PATH bit. Put an echo of the lib path in the script to see if it is working. You might need to put the full path in explicitly.

---

<div class="post-metadata">

**Author:** ![IoTim](https://avatars.discourse-cdn.com/v4/letter/i/58956e/32.png) [@IoTim](https://discourse.nodered.org/u/IoTim)\
**Post date:** [9 December 2021 07:17 UTC](https://discourse.nodered.org/t/exec-node-path-for-shell-script-dependencies/54907/6 "2021-12-09T07:17:13Z")

</div>

Hey @jbudd

Great suggestion! Thank you so much. I don't know why I didn't think of that. I just added it to the top of my script and it worked just fine. Perfect. Just what I needed.

In the event that anyone else needs this solution, my shell script has the following at the top:

#!/bin/bash  
PLUGIN\_PATH="/path/to/plugin"  
LD\_LIBRARY\_PATH="/path/to/lib"  
export PLUGIN\_PATH  
export LD\_LIBRARY\_PATH  
Exec=lxterminal mycommand

Then I just plug

. /path/to/shellscript.sh

into the Exec node and fire it away - and the script is running with its dependencies.

Thanks @jbudd!

---

<div class="post-metadata">

**Author:** ![IoTim](https://avatars.discourse-cdn.com/v4/letter/i/58956e/32.png) [@IoTim](https://discourse.nodered.org/u/IoTim)\
**Post date:** [9 December 2021 07:19 UTC](https://discourse.nodered.org/t/exec-node-path-for-shell-script-dependencies/54907/7 "2021-12-09T07:19:59Z")

</div>

@Colin I'll try your solution out too. Thanks!

---

<div class="post-metadata">

**Author:** ![IoTim](https://avatars.discourse-cdn.com/v4/letter/i/58956e/32.png) [@IoTim](https://discourse.nodered.org/u/IoTim)\
**Post date:** [9 December 2021 07:24 UTC](https://discourse.nodered.org/t/exec-node-path-for-shell-script-dependencies/54907/8 "2021-12-09T07:24:19Z")

</div>

@Colin Your solution worked too!

In the exec node I just put in:

LD\_LIBRARY\_PATH="/path/to/lib" . /path/to/shell/script

Worked like a charm. You guys are great. Thanks all!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 February 2022 07:25 UTC](https://discourse.nodered.org/t/exec-node-path-for-shell-script-dependencies/54907/9 "2022-02-07T07:25:05Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
