# How to debug Javascript in code node

**URL:** <https://community.n8n.io/t/how-to-debug-javascript-in-code-node/22394>\
**Category:** Questions\
**Created:** [January 28, 2023, 11:09pm UTC](https://community.n8n.io/t/how-to-debug-javascript-in-code-node/22394 "2023-01-28T23:09:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pghahrem](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@pghahrem](https://community.n8n.io/u/pghahrem)\
**Post date:** [January 28, 2023, 11:09pm UTC](https://community.n8n.io/t/how-to-debug-javascript-in-code-node/22394/1 "2023-01-28T23:09:42Z")

</div>

## Describe the issue/error/question

How can I debug the Javascript code in code node? Up to now I am using console.log but it would be much easier to be able to debug the code and check the variables. Is this possible? I am using the Windows app.

## What is the error message (if any)?

## Please share the workflow

```auto

```

## Share the output returned by the last node

## Information on your n8n setup

- \*\*n8n version:\*\*Desktop app for Windows 1.7.0
- **Database you’re using (default: SQLite):**
- **Running n8n with the execution process [own(default), main]:**
- **Running n8n via [Docker, npm, n8n.cloud, desktop app]:**

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [January 29, 2023, 4:12am UTC](https://community.n8n.io/t/how-to-debug-javascript-in-code-node/22394/2 "2023-01-29T04:12:51Z")

</div>

No sorry, console.log is currently sadly the only way.

---

<div class="post-metadata">

**Author:** ![pghahrem](https://avatars.discourse-cdn.com/v4/letter/p/8e8cbc/32.png) [@pghahrem](https://community.n8n.io/u/pghahrem)\
**Post date:** [January 31, 2023, 6:17pm UTC](https://community.n8n.io/t/how-to-debug-javascript-in-code-node/22394/3 "2023-01-31T18:17:52Z")

</div>

Hi Jan, thanks for your reply. Is this an option for the future or technically not possible?

Another question related to this. If I am in the code node in an endless loop, is there a way to interrupt it? Currently I am always closing n8n and reopening it again.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [January 31, 2023, 11:46pm UTC](https://community.n8n.io/t/how-to-debug-javascript-in-code-node/22394/4 "2023-01-31T23:46:39Z")

</div>

Theoretically more or less everything is possible. So for sure also that. Is really just about how much resources we allocate on things and how we prioritize things.

If you run n8n in `main` mode stopping and restarting n8n is sadly the only thing that can be done (as then the endless loop blocks the event loop and we can not do anything).  
If you run n8n in `own` mode pressing the stop button should work totally fine (there workflows run in a separate process that n8n can then simply kill).

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [May 1, 2023, 11:47pm UTC](https://community.n8n.io/t/how-to-debug-javascript-in-code-node/22394/5 "2023-05-01T23:47:26Z")

</div>

Closed on May 1, 2023, 11:47pm UTC

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