Exec node is not responding

Hi Team,

I have implemented a node-red flow and accessed the flow by exposing it through an API.
API will trigger the Execute node through which the command will execute based on API params.

Once I load the flow using post API to create a flow and deploy it in node-red.
At that time when I am calling the API to execute the exec command.
The exec node is not getting executed and throwing a timeout. it only works once after we edit(just open and redeploy) the exec node and redeploy it.

Any solution or fix for this? so that when i deploy the flow and call the api, Exec node should be running the command and giving results.

Show us the exact error you are getting please, and tell us where you see it.

How are you triggering the exec node? Can you show your flow?

Also you could try adding a catch node connected to a debug node (set to display the complete msg object) and see if that gives you any more information.

HI @zenofmud @Colin
Please find the flow


when I call get API with params for the 1st time after initial deployment of flow.EXEC node (will generate a file in destination) is not getting executed as expected and it's going to file access node where it will check for the generated output file.
and when the call reaches the file access node it is throwing below error which means the file is not getting generated.
But when we just open the EXEC node and click on done and redeploy it starts working and giving expected output
File C:\Program Files\Connect Transfer\Transformations\Transformed\transformed_input_sample-xml1.xml is not accessible Error: ENOENT: no such file or directory, access 'C:\Program Files\Connect Transfer\Transformations\Transformed\transformed_input_sample-xml1.xml'

Please export your flow and attach it to a reply.
Also what are the versions of NR and node.js?

Have you checked to see if this file actually exists?

How is the exec node set up? Is it possible that it is still running when a new msg arrives?

The FIle is not existed because of exec node is not working on 1st deployment of the flow.
once i just open and click on done and redeploy without any changes from next time it starts working

Attach a debug node to the output of your function node labeled "sending params" and show us the full output when you "call get API with params for the 1st time after initial deployment". So we can see what, if anything is being sent to the exec node labeled "cmd".

Sure @zenofmud

PFA for flow file
output-transfer.json (6.1 KB)

Node-red version -- 1.0.6
nodejs -- 9.6.5

I hope that is not correct as that has never been a supported version of nodejs for node-red. Also everything below v12 is no longer supported (by the nodejs developers or by the current version of node-red) v14 is the one currently recommended for node-red but 12 and 16 are also ok.
In addition, node-red 1.0.6 is very old.

1 Like

Sure @Colin
we are trying to update it to 1.3.5 and node version 12.
But is there any alternative for exec node and run the commands with arguments in nodered?

You don't need an alternative, you just need to configure it correctly and send it the right message. You have not done as Peter requested:

I see you have EXEC in the exec node. I'm not a Windows person so is the command case sensitive?

also can you provide an example of the HTTP being used to run the request?

one other thing, in your function node you have

 flow.set("outputFoldePath",msg.payload.outputFoldePath);
 flow.set("outputFileName", msg.payload.outputFileName, );


msg.payload = "\""+msg.payload.inputFilePath+"\"" +" "+ "\""+ msg.payload.outputFilePath +"\"" +" "+ "\""+msg.payload.logicFilePath+"\"";

you are using msg.payload.outputFoldePath and msg.payload.outputFilePath shouldn't they be the same??

Yeah, my mistake its actually 10.15.3

That is not actually a command, we are using a custom one from environment variables. where exec node will execute it.
Both are a little different outputFoldePath -- gives till the folder
outputFilePath -- gives till the name of the output file - to be created.

Does the file exist?

No, its not there

Well that is why you get the file not found error. Assuming the file should be there then you must work out why it is not there.

So if I understand,

  • the function node create a string that contains three strings seperated by a space
  • each string containing a full path to a filename
  • this payload is sent to the exec node which is running a unknown (to us) command.
  • the unknown command is not returning results

It would seem that the issue is with the program(s) processing the data you are sending it.

But if i execute the same, by just opening the node and redeploying. it is working fine.