Download node modules(such as node-red-node-mysql) by using code

#1

hello,everyone,i can use exec node to do something like remove a file in linux (example:rm xxx.txt), but it cant download a node module(like npm install node-red-node-mysql)

have a good way to do that?

0 Likes

#2

What error does that return?

0 Likes

#3

thank you for reply,return nothing, but download fail

0 Likes

#4

Check the other outputs of the exec node.
Why are you using -g? Normally that would need sudo permissions to run. Also you have selected Append msg.payload, what have you got in the payload that you are appending to the command?

1 Like

#5

As @Colin says, the Exec node has three output ports. Connect them all to a Debug node to see the output - any error messages from the command will be emitted from the second port.

1 Like

#6

@knolleary error:

i did a test use js file , it can download!

:thinking::thinking:

0 Likes

#7

You can see the command it is running has 155549101984 at the end.
That is because, just as @Colin said in his reply, you have the append msg.payload option enabled in the Exec node - so it is adding the timestamp from the Inject node to the end of the command.

Disable that option in the Exec node and it should work.

1 Like

#8

thank you very much,i will try it

0 Likes

#9

:sweat_smile: (my emotion now)

0 Likes

#10

thank you very much

0 Likes