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

**URL:** <https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272>\
**Category:** General\
**Created:** [17 April 2019 06:52 UTC](https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272 "2019-04-17T06:52:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![qgc007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qgc007/32/7362_2.png) [@qgc007](https://discourse.nodered.org/u/qgc007)\
**Post date:** [17 April 2019 06:52 UTC](https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272/1 "2019-04-17T06:52:12Z")

</div>

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)

 ![downloaderror](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/7e123f8e633878243a68adc6527358cac5df82f5.png)

have a good way to do that?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [17 April 2019 07:44 UTC](https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272/2 "2019-04-17T07:44:58Z")

</div>

What error does that return?

---

<div class="post-metadata">

**Author:** ![qgc007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qgc007/32/7362_2.png) [@qgc007](https://discourse.nodered.org/u/qgc007)\
**Post date:** [17 April 2019 08:14 UTC](https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272/3 "2019-04-17T08:14:15Z")

</div>

thank you for reply,return nothing, but download fail

 ![delrst](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/727bb7d92e065a2605df17f8fb42dc59f0f5ffd7.png)

---

<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:** [17 April 2019 08:22 UTC](https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272/4 "2019-04-17T08:22:11Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [17 April 2019 08:52 UTC](https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272/5 "2019-04-17T08:52:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![qgc007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qgc007/32/7362_2.png) [@qgc007](https://discourse.nodered.org/u/qgc007)\
**Post date:** [17 April 2019 08:59 UTC](https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272/6 "2019-04-17T08:59:56Z")

</div>

@knolleary error:

 ![error](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/a3dff89868b75185642220812aef7e769bf8efed.png)

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

 ![codejs](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/561095771cd54639964bf56561a24c1fcbc1111e.png) ![codejs2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/c4f9969c9c3cd8b312f8237cc892ec3f0e8fe1d1.png)

🤔🤔

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [17 April 2019 09:13 UTC](https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272/7 "2019-04-17T09:13:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![qgc007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qgc007/32/7362_2.png) [@qgc007](https://discourse.nodered.org/u/qgc007)\
**Post date:** [17 April 2019 09:14 UTC](https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272/8 "2019-04-17T09:14:23Z")

</div>

thank you very much,i will try it

---

<div class="post-metadata">

**Author:** ![qgc007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qgc007/32/7362_2.png) [@qgc007](https://discourse.nodered.org/u/qgc007)\
**Post date:** [17 April 2019 09:30 UTC](https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272/9 "2019-04-17T09:30:30Z")

</div>

😅 （my emotion now）

---

<div class="post-metadata">

**Author:** ![qgc007](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qgc007/32/7362_2.png) [@qgc007](https://discourse.nodered.org/u/qgc007)\
**Post date:** [17 April 2019 09:41 UTC](https://discourse.nodered.org/t/download-node-modules-such-as-node-red-node-mysql-by-using-code/10272/10 "2019-04-17T09:41:56Z")

</div>

thank you very much
