Exec node cannot find any of my commands

Hi,
I'm working on a production machine for toys. The idea is that the toys are on a production line and my "machine" scans them and logs the production info on a database.
My bash script is ready.
The last step for me is to have a visual interface for logistic purposes. For this I am using node-red.

Good. Now my trouble start when I try to execute my bash script using the exec node.
I have tried these solutions:

None of them worked for me.
I ALWAYS get a "command not found" for every command I am making in my script.
prod_test_flash.sh: line 7: esptool.py: command not found

Can you please help and let me know what I am missing? Thanks

This is a Python script for flashing An ESP8266 ROM bootloader utility, what has it to do with a visual interface?

Try specifying the full path to the esptool.py command in your script. It is probably not in the path for the user that is running node-red.

Thanks, that worked! What's the reason? I've seen example where command path was not specified in scripts.
In addition which did not work for esptool.py and I had to use type (reason).

Used to get the MAC of my machine for logistic purposes

It depends on where the command is and what PATH is specified for the user running node-red. If the command is in that users path then it will find it without needing to fully specify it.

So, I am having the same problem. The strangest part is that the problem seems to have happened on its own as this was working one day and then not the next. I have simplified the problem for debugging. I have a manual inject node going to an Exec node that is trying to run the command /home/ryan/back.sh . I have confirmed the file is in the correct place and the "shebang": at the top of the file is correct. But I am still getting this error:
image

I can run the script fine from the command line. I also tried with sudo and it couldn't find it then either. Anyone have any ideas?

I am not sure but I think the error may be from within your script rather than trying to call it. Try it with a minimal script.
Or try removing it first to see if you get a different error.

I think it has to do with the file permissions because now my automatic login ssh key isn't working either.

Yup...file permissions problem. Reverted to a backup image I took a couple of days ago and magically everything started working again. Don't know what I changed or what I installed that changed my permissions but that was definitely the culprit.

Actually, the solution was a lot easier than I thought. And I post this only in the hopes that someone else will benefit from my stupidity. I had migrated Node Red over to Docker to make backups easier and to make it easier to move to another server should I ever want to. Well, the container uses the file system of the container, not the host! DUH!! Feel really, REALLY stupid...but if I've saved someone else a headache, then it makes it a little easier to stomach.
:clown_face:

1 Like

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