Can't get the themes to work

I had a node-red install on a windows server with the Themes working properly. Due to the tendency of the Windows server to reboot whenever it needs updating (and not restarting node-red server), we decided to move those flows to another node-red server we have, which currently uses the eye-searing white theme.

Steps I did were as follow: I did an SSH into the server, changed to the /.node-red/ directory and ran:

npm install @node-red-contrib-themes/midnight-red

I can see it created a folder with that name inside of /node-red/node-modules.

I changed settings.js to look like this, as per the instructions

editorTheme: {
    theme: "midnight-red",
    projects: {
        enabled: false
    }
}

But after restarting the server and resetting the browser cache, nothing happens, and loads the usual white UI.

If I try to install it again, I get an npm ERR! code EINVALIDTAGNAME

Invalid tag name ""~"0.3.1": Tags may not have characters that encodeURIComponent encodes.

If I try to install only midnight-red, I get the same problem.

I'll be very grateful for any ideas.

What versions of npm and nodejs are you using? That sounds like a bug that was in a superseded version of npm.

Also what version of node-red and what OS?

Have a look in package.json and look for the line for the theme, what does it show?

[Edit] Also post the startup log for node-red please that you see when you start it in a terminal.

Thanks for the reply!

I made sure the npm and node.js were running the last versions, but it seems like node-red was running an older version.

Generally, I update the packages from the "manage palette" dialog, and I didn't see the option to update node-red, so I hadn't.

I updated it from the command line, and now the theme is working. What I don't get is why themes were working in Windows but not in centOS, with the same node-red version.

Anyway, problem solved, thanks.

Was it the same nodejs and npm version?

Today, I'm getting a similar error trying to install the node-red-contrib-opcua node. I go to the palette manager, click install, and I get the following log:

2021-10-27T08:54:53.436Z Install : node-red-contrib-opcua 0.2.242

2021-10-27T08:54:51.854Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-opcua@0.2.242
2021-10-27T08:54:52.429Z [err] npm
2021-10-27T08:54:52.430Z [err] ERR! code EINVALIDTAGNAME
2021-10-27T08:54:52.434Z [err] npm
2021-10-27T08:54:52.434Z [err] ERR! Invalid tag name ""~"0.3.1": Tags may not have any characters that encodeURIComponent encodes.
2021-10-27T08:54:52.439Z [err]
2021-10-27T08:54:52.439Z [err] npm ERR!
2021-10-27T08:54:52.439Z [err] A complete log of this run can be found in:
2021-10-27T08:54:52.439Z [err] npm
2021-10-27T08:54:52.439Z [err] ERR! /root/.npm/_logs/2021-10-27T08_54_52_435Z-debug.log
2021-10-27T08:54:52.444Z rc=1

The system is running the following:

  • node-red v2.1.2
  • node.js v12.22.7
  • npm v8.1.1
  • centOS v8.4-1.2105.el8.noarch

Can you post your package.json please?

Edit: did you copy the package.json from the other machine by any chance?

I did not copy the package.json from the other machine. this is the package.json:

{
    "name": "node-red-project",
    "description": "A Node-RED Project",
    "version": "0.0.1",
    "private": true,
    "dependencies": {
        "@node-red-contrib-themes/theme-collection": "^2.1.1",
        "node-red-contrib-calc": "~1.0.5",
        "node-red-contrib-counter": "~0.1.6",
        "node-red-contrib-finite-statemachine": "~2.0.0",
        "node-red-contrib-mcprotocol": "~1.2.1",
        "node-red-contrib-moment": "~4.0.0",
        "node-red-contrib-mssql-plus": "~0.7.3",
        "node-red-contrib-rpi-shutdown": "0.0.2",
        "node-red-contrib-s7": "~3.0.0",
        "node-red-contrib-s7comm": "~1.1.6",
        "node-red-contrib-ui-artless-gauge": "~0.3.11",
        "node-red-dashboard": "~3.0.4",
        "node-red-node-mysql": "~0.2.2",
        "node-red-node-rbe": "~0.5.0",
        "node-red-node-smooth": "~0.1.2"
    }
}

Eventually, I will import the flows from the Windows machine to have everything in a single machine, but at the moment, each node-red server has its own project.

I checked this "0.3.1" thing. Some time ago, I did some tests importing log files and needed the tail node. That node had this version number, and apparently it was causing problems.

Since I didn't use it, I uninstalled it, and then I was able to install the node-red-contrib-opcua 0.2.242 from command line without errors.

However, after installing, node-red crashed hard. I went into command line, and in htop I saw the CPU usage was off the charts (over 90%). Node-red editor was not loading.

I went into node-modules and deleted all the folders from the opc-ua node, and immediately after deleting them, the editor could load in the browser.

I think the server is on top of an ancient burial ground or something.

Search for 0.3.1 in package-lock.json, perhaps it is wrong in there.

If not then clean the npm cache and try again
npm cache clean --force

As I said in one of my previous replies, there was a package with that number, but I was able to uninstall it with the palette manager.

Installing the opc-ua package makes node-red crash, though.

Do you mean you fixed the 0.3.1 problem but now you have a different problem? If so then best to start a new thread with that.

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