Exec node path for shell script dependencies

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.

Hi Tim,

Have you restarted Node-Red?

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

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?

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

What happens if you set LD_LIBRARY_PATH in the shell script?

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.

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!

1 Like

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

@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!

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