# Range error - The value "NaN" is invalid

**URL:** <https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778>\
**Category:** General\
**Created:** [23 June 2020 06:27 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778 "2020-06-23T06:27:21Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jan12](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jan12](https://discourse.nodered.org/u/jan12)\
**Post date:** [23 June 2020 06:27 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/1 "2020-06-23T06:27:21Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/4/34b00bcb45a7803398a54c7b08d38a62a5186732.png)

Got a big problem with a range error. I've tried to uninstal and instal js again but still the same problem.  
Can any help have I solve it.

Thanks  
Jan

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [23 June 2020 06:30 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/2 "2020-06-23T06:30:36Z")

</div>

So, let's clear up what is happening.

> [@jan12](#):
>
> I've tried to uninstal and instal js again

Do you mean `Node-Red`?

Do you have any flows? (Code/nodes/programs) loaded in `Node-Red`?

Which nodes do you have installed? Taking it that you are using `Node-Red` and writing programs.

---

<div class="post-metadata">

**Author:** ![jan12](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jan12](https://discourse.nodered.org/u/jan12)\
**Post date:** [23 June 2020 06:32 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/3 "2020-06-23T06:32:53Z")

</div>

Yes i mena Node-red.  
Yes there is a flow loaded in Node-red  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/f/4f13bcef6944c8228ff5361bf2342048597d5b44.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [23 June 2020 06:34 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/4 "2020-06-23T06:34:56Z")

</div>

Looking hard at the screen shot you initially posted (text copy/paste would be a lot easier), it would seem you are getting a message from your PLC and one of the messages is not a number.

How about you do a screen shot of the node-red part of things with the nodes?

Particularly the node coming from the PLC.

You do know how to look at the node-red code in a browser - as to now I just realised you may not as you are posting stuff from a _terminal_ (CLI/DOS)

---

<div class="post-metadata">

**Author:** ![jan12](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jan12](https://discourse.nodered.org/u/jan12)\
**Post date:** [23 June 2020 06:39 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/5 "2020-06-23T06:39:31Z")

</div>

correct I'am connected to a PLC, but I can't start Node-Red up in the command prompt

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [23 June 2020 06:44 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/6 "2020-06-23T06:44:35Z")

</div>

> [@jan12](#):
>
> but I can't start Node-Red up in the command prompt

Errr, you are starting `Node-Red` from the command prompt.

There is a problem with what the PLC is sending to `Node-Red`. There are two options:  
You fix what is being sent or you have to edit the node in node-red to get around the _problem_.

So, I hope you know what the computer's IP address is.......

Open a browser.

In the address bar (where you enter the site) enter:  
`<ip address of the computer node-red is on>:1880`

So for example:  
`192.168.12.12:1880`

That will load the node-red GUI. You need to learn how to use this so you can find how to stop the error.

Or: You can get into the PLC and change the code there so it only sends **numbers** , as the error is indicative that one of the messages isn't a number.

Which way do you want to go?

---

<div class="post-metadata">

**Author:** ![jan12](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jan12](https://discourse.nodered.org/u/jan12)\
**Post date:** [23 June 2020 06:48 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/7 "2020-06-23T06:48:55Z")

</div>

> [@Trying\_to\_learn](#):
>
> Errr, you are starting `Node-Red` from the command prompt.
> 
> There is a problem with what the PLC is sending to `Node-Red` . There are two options:  
> You fix what is being sent or you have to edit the node in node-red to get around the _problem_ .
> 
> So, I hope you know what the computer's IP address is.......
> 
> Open a browser.
> 
> In the address bar (where you enter the site) enter:  
> `<ip address of the computer node-red is on>:1880`
> 
> So for example:  
> `192.168.12.12:1880`
> 
> That will load the node-red GUI. You need to learn how to use this so you can find how to stop the error.
> 
> Or: You can get into the PLC and change the code there so it only sends **numbers** , as the error is indicative that one of the messages isn't a number.
> 
> Which way do you want to go?

I'am note sure that the PLC are sending data - I belive that node-red are pick-up the data from PLC.  
I try to go the browser

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [23 June 2020 06:51 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/8 "2020-06-23T06:51:05Z")

</div>

> [@jan12](#):
>
> I'am note sure that the PLC are sending data - I belive that node-red are pick-up the data from PLC.  
> I try to go the browser

The PLC **is** sending data. That is shown in the initial screen shot you showed.

I hope you will get the browser loaded and showing the page with _nodes_ connected to one another.

That's where we will start finding the problem.

---

<div class="post-metadata">

**Author:** ![jan12](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jan12](https://discourse.nodered.org/u/jan12)\
**Post date:** [23 June 2020 06:56 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/9 "2020-06-23T06:56:47Z")

</div>

I can't connect by browser.  
Normely I start "node-red" in my command prompt and after that I get my Node-red GUI.  
I have tried with [http://127.0.0.1:1880](http://127.0.0.1:1880) - but no connection.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [23 June 2020 07:02 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/10 "2020-06-23T07:02:00Z")

</div>

> [@jan12](#):
>
> Normely I start "node-red" in my command prompt and after that I get my Node-red GUI.

No. It doesn't work like that AFAIK.

The GUI is only loaded via the browser.

Ok, from the _command prompt_ change to the node-red directory and enter:  
(oh, you are windows....)  
`node-red-stop`  
then  
`node-red-start`

Let it go through the motions.

Copy/paste the text and I will see what I can determine. **do not do a screen print** It makes it too difficult to read.  
(Please understand my _name_ is indicative of my knowledge, so I can't promise I will know the answer)

---

<div class="post-metadata">

**Author:** ![jan12](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jan12](https://discourse.nodered.org/u/jan12)\
**Post date:** [23 June 2020 07:08 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/11 "2020-06-23T07:08:56Z")

</div>

You are already my Herro 🙂

It is strange I have wrote in command promt "Node-red stop" and than I got connected to the GUI but if I try again only with "Node-red" as I normaly does I got the same problem again

I will now import my last session

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [23 June 2020 07:10 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/12 "2020-06-23T07:10:13Z")

</div>

> [@jan12](#):
>
> "Node-red stop"

I said `node-red-stop`. (note the `-` between red and stop)

However, we have moved forward. Good.

Take a screen shot of the GUI - just out of interest.

---

<div class="post-metadata">

**Author:** ![jan12](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jan12](https://discourse.nodered.org/u/jan12)\
**Post date:** [23 June 2020 07:14 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/13 "2020-06-23T07:14:40Z")

</div>

I tried with node-red-stop but got this message" 'node-red-stop' is not recognized as an internal or external command, operable program or batch file."

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [23 June 2020 07:21 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/14 "2020-06-23T07:21:34Z")

</div>

Well, now we are seeing the _GUI_, we can make steps.

I take it you cropped this screen shot?  
Usually on the left and right there are other things shown/visible.

If they aren't and this is all you are seeing, press `control` `space` and that should open a list on the right side of the screen. This is very important as it will show you what the `debug` nodes are getting.

So, I'll wait for your reply to this and then we can go to the next step.

---

<div class="post-metadata">

**Author:** ![jan12](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jan12](https://discourse.nodered.org/u/jan12)\
**Post date:** [23 June 2020 07:25 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/15 "2020-06-23T07:25:26Z")

</div>

> [@Trying\_to\_learn](#):
>
> Well, now we are seeing the _GUI_ , we can make steps.
> 
> I take it you cropped this screen shot?  
> Usually on the left and right there are other things shown/visible.
> 
> If they aren't and this is all you are seeing, press `control` `space` and that should open a list on the right side of the screen. This is very important as it will show you what the `debug` nodes are getting.
> 
> So, I'll wait for your reply to this and then we can go to the next step.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/3/338fb665ec14d9f60c013efbc3941a7ea95677c2.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/8/2821f40f9b8d3aaf8de8caf22be16424c7618c5d.png)

I have defined in "S7" block two values "ID.DB and LT\_IN" both with the MW in the PLC

---

<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:** [23 June 2020 07:26 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/16 "2020-06-23T07:26:33Z")

</div>

The original screenshot shows this is an error in the nodes7 module. The node using that module is missing the proper error handling to prevent the uncaught exception issue.

This needs reporting against whichever node you have installed for s7.

---

<div class="post-metadata">

**Author:** ![jan12](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jan12](https://discourse.nodered.org/u/jan12)\
**Post date:** [23 June 2020 07:27 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/17 "2020-06-23T07:27:29Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/f/2f391bfc1cc1e6b27ef458376be41d4697a8591d.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [23 June 2020 07:27 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/18 "2020-06-23T07:27:29Z")

</div>

On the screen where you showed me the nodes, press the `control` key (and hold it down) and press the `space` bar/button/key.

That will allow you to see the outputs.

@knolleary Thanks for stepping in. I fear I am really out of my depth.

---

<div class="post-metadata">

**Author:** ![jan12](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jan12](https://discourse.nodered.org/u/jan12)\
**Post date:** [23 June 2020 07:33 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/19 "2020-06-23T07:33:31Z")

</div>

I can't open by ctrl + space ??

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [23 June 2020 07:35 UTC](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778/20 "2020-06-23T07:35:21Z")

</div>

How did you get that screen you showed before?

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

When you are looking at that, press control space.

For example:

Original:

 ![Screenshot from 2020-06-23 17-36-48](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/9/b9a50c8534a982a1e8c19a16b2dba06a6ff83b81.png)

Press `control space` and you see:

 ![Screenshot from 2020-06-23 17-36-51](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/9/99d3a802977ed2958f017d7166b24e54649e1a5c.png)

[Next page](https://discourse.nodered.org/t/range-error-the-value-nan-is-invalid/28778.md?page=2)
