# Exec node cannot find any of my commands

**URL:** <https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810>\
**Category:** General\
**Created:** [12 November 2018 18:03 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810 "2018-11-12T18:03:51Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![valentin](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@valentin](https://discourse.nodered.org/u/valentin)\
**Post date:** [12 November 2018 18:03 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/1 "2018-11-12T18:03:51Z")

</div>

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:

- [How to run a bash script from node red?](https://discourse.nodered.org/t/how-to-run-a-bash-script-from-node-red/406)
- [Exec node error when running terminal commands](https://discourse.nodered.org/t/exec-node-error-when-running-terminal-commands/1839/20)
- [https://stackoverflow.com/questions/33222875/how-to-run-a-command-in-node-red-node-exec-to-enable-a-script-for-lcd](https://stackoverflow.com/questions/33222875/how-to-run-a-command-in-node-red-node-exec-to-enable-a-script-for-lcd)

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

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [12 November 2018 18:21 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/2 "2018-11-12T18:21:46Z")

</div>

> [@valentin](#):
>
> esptool.py

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

---

<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:** [12 November 2018 18:25 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/3 "2018-11-12T18:25:29Z")

</div>

> [@valentin](#):
>
> Can you please help and let me know what I am missing? Thanks

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.

---

<div class="post-metadata">

**Author:** ![valentin](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@valentin](https://discourse.nodered.org/u/valentin)\
**Post date:** [13 November 2018 10:02 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/4 "2018-11-13T10:02:20Z")

</div>

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](https://askubuntu.com/questions/551254/why-which-returns-none-on-some-commands-i-can-run)).

---

<div class="post-metadata">

**Author:** ![valentin](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@valentin](https://discourse.nodered.org/u/valentin)\
**Post date:** [13 November 2018 10:02 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/5 "2018-11-13T10:02:57Z")

</div>

Used to get the MAC of my machine for logistic purposes

---

<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:** [13 November 2018 10:56 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/6 "2018-11-13T10:56:21Z")

</div>

> [@valentin](#):
>
> What's the reason? I've seen example where command path was not specified in scripts.

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.

---

<div class="post-metadata">

**Author:** ![ryan780](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ryan780/32/22974_2.png) [@ryan780](https://discourse.nodered.org/u/ryan780)\
**Post date:** [30 May 2020 03:34 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/7 "2020-05-30T03:34:05Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/78787d818cf88b6c485f3a27d6a85bd65d915dfd.png)

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?

---

<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:** [30 May 2020 06:08 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/8 "2020-05-30T06:08:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ryan780](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ryan780/32/22974_2.png) [@ryan780](https://discourse.nodered.org/u/ryan780)\
**Post date:** [30 May 2020 06:23 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/9 "2020-05-30T06:23:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ryan780](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ryan780/32/22974_2.png) [@ryan780](https://discourse.nodered.org/u/ryan780)\
**Post date:** [30 May 2020 17:31 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/10 "2020-05-30T17:31:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ryan780](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ryan780/32/22974_2.png) [@ryan780](https://discourse.nodered.org/u/ryan780)\
**Post date:** [8 June 2020 04:06 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/11 "2020-06-08T04:06:08Z")

</div>

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.  
🤡

---

<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:** [22 June 2020 04:06 UTC](https://discourse.nodered.org/t/exec-node-cannot-find-any-of-my-commands/4810/12 "2020-06-22T04:06:10Z")

</div>

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