# Debugging external JavaScript code

**URL:** <https://discourse.nodered.org/t/debugging-external-javascript-code/89665>\
**Category:** General\
**Created:** [22 July 2024 10:46 UTC](https://discourse.nodered.org/t/debugging-external-javascript-code/89665 "2024-07-22T10:46:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [22 July 2024 10:46 UTC](https://discourse.nodered.org/t/debugging-external-javascript-code/89665/1 "2024-07-22T10:46:14Z")

</div>

I'm running an external .js file  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c3e1ab1e62815d22412654fdf0fea8719ab27ed4.png)

but it wasn't working as expected (I've fixed it now - just a path issue)

But I added a console.log line to try and find out where things were going wrong but it didn't appear in the console (or the node-red terminal where I launched nr from)

How do I view/add debugging to an external .js file?

---

<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:** [22 July 2024 11:34 UTC](https://discourse.nodered.org/t/debugging-external-javascript-code/89665/2 "2024-07-22T11:34:18Z")

</div>

All of the output of the script will be written into the payload of the message the node sends on after the command completes.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [22 July 2024 11:42 UTC](https://discourse.nodered.org/t/debugging-external-javascript-code/89665/3 "2024-07-22T11:42:13Z")

</div>

Thank you 🙂  
I only had debug node on output 3  
Once I added the others - I see my console.log()s 🙂

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/9/b96b08f117de0ee5ec61fc69b3c6e81ae6ff88f9.png)

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [24 July 2024 06:42 UTC](https://discourse.nodered.org/t/debugging-external-javascript-code/89665/4 "2024-07-24T06:42:59Z")

</div>

Top output is stdout, next is stderr, and last is any return code

---

<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:** [7 August 2024 06:43 UTC](https://discourse.nodered.org/t/debugging-external-javascript-code/89665/5 "2024-08-07T06:43:22Z")

</div>

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