ReferenceError: node is not defined

#1

hi guys,

yesterday I have made a fatal mistake which broke my node red (again :frowning: ).

I have copied couple of nodes between two machines running node red.

unfortunately this broke node red and removing npm, node js, deleted home folder and reinstalling everything (but not wiping system completely) didn't help.

basically there must be a reference to a sensor saved somewhere on the system and it keeps remembering that sensor ID and every time, even after reinstalling NR gives this error:

ReferenceError: node is not defined

and in console im getting this: Mar 10:15:05 - [error] [xiaomi-ht:testu] ReferenceError: node is not defined

is there a way of completely wiping all stuff node-red related so i can start fresh without wiping the system?

thank you

0 Likes

#2

You certainly did not need to do all that to fix the problem, whatever it is. Show us the startup log from node red, it starts with the Welcome to node-RED message.

Also tell us what operating system/hardware you are running on and how you installed it.

0 Likes

#3

Hi @Colin, thank you for your reply.

I am currently running NR on debian stretch 64 bit, with latest npm and node js version 10.15.2 lts.

heres the output from startup:

Starting as a systemd service.
Started Node-RED graphical event wiring tool.
2 Mar 10:51:26 - [info]
Welcome to Node-RED
===================
2 Mar 10:51:26 - [info] Node-RED version: v0.19.6
2 Mar 10:51:26 - [info] Node.js  version: v10.15.2
2 Mar 10:51:26 - [info] Linux 4.9.0-8-amd64 x64 LE
2 Mar 10:51:27 - [info] Loading palette nodes
2 Mar 10:51:27 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
2 Mar 10:51:27 - [warn] rpi-gpio : Cannot find Pi RPi.GPIO python library
2 Mar 10:51:27 - [warn] ------------------------------------------------------
2 Mar 10:51:27 - [warn] [node-red-contrib-mi-sensors/xiaomi-yeelight] Error: /home/bednarz/.node-red/node_modules/node-red-contrib-mi-sensors/dist/nodes/yeelight/index.html does not exist
2 Mar 10:51:27 - [warn] ------------------------------------------------------
2 Mar 10:51:27 - [info] Settings file  : /home/bednarz/.node-red/settings.js
2 Mar 10:51:27 - [info] Context store  : 'default' [module=memory]
2 Mar 10:51:27 - [info] User directory : /home/bednarz/.node-red
2 Mar 10:51:27 - [warn] Projects disabled : editorTheme.projects.enabled=false
2 Mar 10:51:27 - [info] Flows file     : /home/bednarz/.node-red/flows_debian.json
2 Mar 10:51:27 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
2 Mar 10:51:27 - [info] Starting flows
2 Mar 10:51:27 - [info] [xiaomi-gateway out:hub] udp.status.ready-nolocal
2 Mar 10:51:27 - [info] Started flows
2 Mar 10:51:27 - [info] [xiaomi-gateway in:hub] udp.status.listener-at
2 Mar 10:51:27 - [info] [xiaomi-gateway in:hub] udp.status.mc-group
2 Mar 10:51:27 - [info] Server now running at http://127.0.0.1:1880/

and it runs fine with other sensors, that are added, but this one particular that causes issues - does not work. sensor itself does work and also runs fine on my other node red system.

thank you

0 Likes

#4

I see that node ( node-red-contrib-mi-sensors ) is from the github repository https://github.com/yaming116/node-red-contrib-mi-devices which is a fork of https://github.com/pierrecle/node-red-contrib-mi-devices which has this issue against it: https://github.com/pierrecle/node-red-contrib-mi-devices/issues/42
That issue suggests a workaround which may be helpful to you.

0 Likes

#5

thank you, but that is not that issue.

this one refers to yeelights node, which gives out the error but this error is not related to the issue i am having.

thank you

0 Likes

#6

I can see that error in the log you posted. Fix that one first.
[Edit] Further, the error you say you are getting is not in the log.

0 Likes

#7

Further, you say you want to wipe all node-red related stuff so you can start afresh, but presumably after you deleted your home folder and started again, when you first ran node-red you did not see the problem. If so then what good will uninstalling node-red do?

0 Likes

#8

Hi Colin, thank you for your replies and your time. After wiping home folder out as well as removing npm/node js and starting fresh - I can see the error coming up.

It is only with this sensor, and that very same sensor works on my other instance of node-red on raspi.

I am in the middle of setting up VM just for node-red which I will be able to regularly back up, hope this will be best.

NR and npm/node js is still new to me.

0 Likes

#9

If you wiped your home folder then it should have started with an empty flow. So you should not get the errors. The xaomi node will not even be installed.

0 Likes

#10

This is exactly what I thought but it wasn't the case and I have no idea why.

0 Likes

#11

Delete the .node-red folder /home/bednarz/.node-red (or rename it in case you want it back) and restart node-red. See what it shows in the log then. Post that log here if necessary. Note that it will be different the first time as it should show it creating an empty flows file.

0 Likes

#12

I have already done that and that one sensor did not work. I have also wiped that drive and setup windows with VM with Debian. That way will be easier to backup and restore.

Thank you for your help.

0 Likes