Node red wont load correctly after update - ip problem

I have recently attempted to update to node red 1.0 on pi 3b+ . I used the bash script to upgrade. After complete I tried to open the the gui and editor, but It wont load. I noticed that IP adress of the nodered is dofferent from the rpi.
I have set static dhcp lease for rpi on my router.
Mqtt and grafana are working, I just cant get to Nodered, because it changed the IP adress.

Once Node-RED has started, point a browser at http://192.168.1.200:1880
On Pi Node-RED works better with the Firefox or Chrome browser
 
Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot
 
To find more nodes and example flows - go to http://flows.nodered.org
 
Starting as a systemd service.
Error loading settings file: /home/pi/.node-red/settings.js
Error: The module '/home/pi/.node-red/node_modules/i2c-bus/build/Release/i2c.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1208:18)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at bindings (/home/pi/.node-red/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/home/pi/.node-red/node_modules/i2c-bus/i2c-bus.js:4:32)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
nodered.service: Succeeded.

IP adress of the PI is 192.168.1.100 and nodered was on this adress on the port 1883, but after updating nodered the IP of rpi is the same, but I can see that Nodered changed its IP to the xxx.200

I can see other problems in the log, could it be the problem?

Any ideas?

In a terminal type
ifconfig
or if that is not found
ip address
and show us what it says.

ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:09:fa:f8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.240/24 brd 192.168.1.255 scope global dynamic noprefixroute eth0
       valid_lft 42420sec preferred_lft 37020sec
    inet6 fe80::683d:f5fa:1cc9:f51c/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:5c:af:ad brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.105/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0
       valid_lft 42428sec preferred_lft 37028sec
    inet6 fe80::61d8:42c9:b729:e060/64 scope link 
       valid_lft forever preferred_lft forever

wlan0 IP adress was used till now, eth0 is the new nodered IP address ( i didnt wrote correct ip address in first post)

You have both wifi and an ethernet connection enabled, so the device has two ip addresses, 192.168.1.240 on the wired connection and 192.168.1.105 on the wifi connection. That is nothing to do with node-red. You can use either to connect to the pi, so even though the log suggests one the other should work equally well. To avoid confusion you might be best to unplug the cable or disable the wifi, though there is no harm in having both active.

As for the problem with i2c node I suspect the problem is that you have upgraded to nodejs 12.x and that node is not compatible with nodejs 12. It would have been better if you had posted the complete startup log so we could have seen this. Either look there or run
node -v
to check.

You can see the issues raised against the node in the link below. Unfortunately it appears that the node is no longer supported.

Thanks for detailed answer.
I dont need i2c node anymore, so I will delete it.
Any ideas how to do it from the terminal.

As for original problem, the problem is that when node red is started:
Once Node-RED has started, point a browser at http://192.168.1.240:1880

it pointed to http://192.168.1.105:1880, before the update.
Now I cant access it from any of the above IPs.

Any other suggestions?
Im lucky that I made a backup of SD card recently and exported the flows, so If I need I will reimage the sd card.
I just wonder if this is gonna happen again?

node -v
v12.16.1

Thanks

To remove the node

cd ~/.node-red
npm remove node-red-contrib-i2c

As I said, you should be able to access node-red via either address. The reason you can't access it is because it has failed as shown in the log.

Thanks again, I had hopes but I get many more error messages when I try to uninstall the i2c node, which I dont think its worth posting
I will revert to my backupand deleted the nodes before I make an update to nodered, which I probably the best solution.

Don't revert, that is only postponing the issue. Post the errors. We are used to seeing lots of error messages.
Also half the time they are only warnings.

I reverted against you suggestions and I made another loop, so Im back to the start of this topic.
I manually deleted all unused nodes from the pallete, and started the update again...and again I cant access the node red on any IP. Im sure something broke the setting of the nodered adress, as it has changed from 105 to 240. I have checked and I indeed could access both IPs before the update...

Here is the log after I used the terminal to uninstall the i2c node, if you can help

nce Node-RED has started, point a browser at http://192.168.1.240:1880
On Pi Node-RED works better with the Firefox or Chrome browser
 
Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot
 
To find more nodes and example flows - go to http://flows.nodered.org
 
Starting as a systemd service.
Error loading settings file: /home/pi/.node-red/settings.js
Error: The module '/home/pi/.node-red/node_modules/i2c-bus/build/Release/i2c.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 64. This version of Node.js requires
NODE_MODULE_VERSION 72. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1208:18)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at bindings (/home/pi/.node-red/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/home/pi/.node-red/node_modules/i2c-bus/i2c-bus.js:4:32)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
nodered.service: Succeeded.

For some reason removing the contrib node has not removed the i2c-bus module, which would have been pulled in by the contrib node. Go into the .node-red folder and remove that too
npm remove i2c-bus

I removed both and I the error below

I also checked the log before revert and it really did start a server on xxx.240 ip address even before revert

Starting as a systemd service.
Error loading settings file: /home/pi/.node-red/settings.js
nodered.service: Succeeded.

This is the settings.js>

/**
 * Originale latest version: https://raw.githubusercontent.com/node-red/node-red/master/settings.js
 **/

var fs = require("fs");
var i2c = require("i2c-bus");
var mySettings;
try {
        mySettings = require("/home/pi/.node-red/redvars.js");
} catch(err) {
        mySettings = {};
}

module.exports = {
    uiPort: process.env.PORT || 1880,
    mqttReconnectTime: 15000,
    serialReconnectTime: 15000,
    debugMaxLength: 1000,
    flowFile: 'flows.json',
    flowFilePretty: true,
    httpStatic: '/home/pi/.node-red/public',
    functionGlobalContext: {
        os:require('os'),
        moment:require('moment'),
        fs:require('fs'),
                i2c:require('i2c-bus'),
        mySettings:mySettings
    },
    logging: {
        console: {
            level: "info",
            metrics: false,
            audit: false
        }
    },
    adminAuth: { type: "credentials", users: [{ username: "x", password: "x", permissions: "*" }] },
    httpNodeAuth: {user:"x", pass:"x"},
    editorTheme: { projects: { enabled: false }
    }

    // By default, credentials are encrypted in storage using a generated key. To
    // specify your own secret, set the following property.
    // If you want to disable encryption of credentials, set this property to false.
    // Note: once you set this property, do not change it - doing so will prevent
    // node-red from being able to decrypt your existing credentials and they will be
    // lost.
    //credentialSecret: "a-secret-key",

    //https: {
    //    key: fs.readFileSync('privatekey.pem'),
    //    cert: fs.readFileSync('certificate.pem')
    //},
    //requireHttps: true
}



You are trying to load the module you have just removed. Presumably you put that in at some point.

After deleting the settings file, everything started to work as it should.
Many thanks for you help!

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