mikakaraila / node-red-contrib-opcua

A Node-RED node to communicate OPC UA. Uses node-opcua library.
Other
208 stars 191 forks source link

From v.0.2.300 on no more OPCUA-Client and OPCUA-Server nodes available #537

Closed arol-varesi closed 1 year ago

arol-varesi commented 1 year ago

Updating library on my projects, on several different hardwares, fOPCUA-Client and OPCUA-Server nodes are lost. Immagine 2023-03-14 115420

mikakaraila commented 1 year ago

Something is missing / not installed. Any console output?

arol-varesi commented 1 year ago

Found that even with 0.2.297 from yesterday on there is the same problem:
immagine

arol-varesi commented 1 year ago

Something is missing / not installed. Any console output?

Nothing strange. I had a automatic installation from my package.json

{
    "name": "projectname",
    "description": "description",
    "version": "0.0.2",
    "dependencies": {
        "node-red-contrib-fs-ops": "~1.6.0",
        "node-red-contrib-modbus": "~5.25.0",
        "node-red-contrib-mongodb": "0.3.4",
        "node-red-contrib-opcua": "0.2.297",
        "node-red-contrib-tcp-client": "~0.1.3",
        "node-red-dashboard": "~3.3.1",
        "node-red-node-ui-list": "~0.3.6",
        "node-red-node-ui-table": "~0.4.3"
    },
    "node-red": {
        "settings": {
            "flowFile": "flows.json",
            "credentialsFile": "flows_cred.json"
        }
    }
}

I tried also to log into the docker container, uninstall and reinstall node-red-contrib-opcua and seem nothing strange. I will redo it and give you the console log.

mikakaraila commented 1 year ago

Or when you try to start flow it will show some errors... I found one bug and test it then I can publish new version.

arol-varesi commented 1 year ago

No way to start a flow as no possible to use OPCUA-Client and OPCUA-Server nodes. These are not in the palette. immagine

Attached a full log of installation. opcua-install-log.txt

mikakaraila commented 1 year ago

No errors in the install log, strange... if your start some other or empty flow any messages on console?

arol-varesi commented 1 year ago

None. I suppose some uncompatibility with other nodes that arise yesterday. I will try to add one package at time to check. I will give you a feedback. I just want you to know that with only opcua lib seem to work.

EDIT: sorry seems no working

arol-varesi commented 1 year ago

Steps to reproduce error

Started with Node-red Docker image version v2.1.3

1. Palette has nothing installed:

immagine

2. Install node-red-contrib-opcua from Palette menu

immagine

3. Seem installation to be with no problems

immagine

4. Close and reopen palette show some warnings

immagine

5. Trying to deploy a flow with OPC UA server rises next error

immagine

mikakaraila commented 1 year ago

Something is missing... I really need some debug/console log to find missing dependency.

arol-varesi commented 1 year ago

It seems that it does not work only on v2.x.x of Nodered. (With version 3.0 seem to work)

Thi is the log during installation

-----------------------------------------------------------
2023-03-14T14:01:11.959Z Install : node-red-contrib-opcua 0.2.300

2023-03-14T14:01:11.967Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-opcua@0.2.300
2023-03-14T14:01:45.319Z [err] npm
2023-03-14T14:01:45.319Z [err]  notice created a lockfile as package-lock.json. You should commit this file.
2023-03-14T14:01:45.327Z [err] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
2023-03-14T14:01:45.327Z [err] npm WARN 
2023-03-14T14:01:45.327Z [err] notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2023-03-14T14:01:45.327Z [err] 
2023-03-14T14:01:45.328Z [out] + node-red-contrib-opcua@0.2.300
2023-03-14T14:01:45.328Z [out] added 174 packages from 171 contributors in 32.596s
2023-03-14T14:01:45.356Z rc=0

-----------------------------------------------------------

And this is the console output from docker command:

docker-nodered-node-red-1  | 
docker-nodered-node-red-1  | > node-red-docker@2.2.3 start /usr/src/node-red
docker-nodered-node-red-1  | > node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"
docker-nodered-node-red-1  | 
docker-nodered-node-red-1  | 14 Mar 15:10:34 - [info] 
docker-nodered-node-red-1  | 
docker-nodered-node-red-1  | Welcome to Node-RED
docker-nodered-node-red-1  | ===================
docker-nodered-node-red-1  | 
docker-nodered-node-red-1  | 14 Mar 15:10:34 - [info] Node-RED version: v2.2.3
docker-nodered-node-red-1  | 14 Mar 15:10:34 - [info] Node.js  version: v14.18.2
docker-nodered-node-red-1  | 14 Mar 15:10:34 - [info] Linux 5.15.90.1-microsoft-standard-WSL2 x64 LE
docker-nodered-node-red-1  | 14 Mar 15:10:34 - [info] Loading palette nodes
docker-nodered-node-red-1  | 14 Mar 15:10:35 - [warn] ------------------------------------------------------
docker-nodered-node-red-1  | 14 Mar 15:10:35 - [warn] [node-red-contrib-opcua/OpcUa-Client] Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: node:stream/promises
docker-nodered-node-red-1  | 14 Mar 15:10:35 - [warn] [node-red-contrib-opcua/OpcUa-Server] Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: node:stream/promises
docker-nodered-node-red-1  | 14 Mar 15:10:35 - [warn] ------------------------------------------------------
docker-nodered-node-red-1  | 14 Mar 15:10:35 - [info] Settings file  : /data/settings.js
docker-nodered-node-red-1  | 14 Mar 15:10:35 - [info] Context store  : 'default' [module=memory]
docker-nodered-node-red-1  | 14 Mar 15:10:35 - [info] User directory : /data
docker-nodered-node-red-1  | 14 Mar 15:10:35 - [warn] Projects disabled : editorTheme.projects.enabled=false
docker-nodered-node-red-1  | 14 Mar 15:10:35 - [info] Flows file     : /data/flows.json
docker-nodered-node-red-1  | 14 Mar 15:10:36 - [info] Server now running at http://127.0.0.1:1880/
docker-nodered-node-red-1  | 14 Mar 15:10:36 - [warn] 
docker-nodered-node-red-1  | 
docker-nodered-node-red-1  | ---------------------------------------------------------------------
docker-nodered-node-red-1  | Your flow credentials file is encrypted using a system-generated key.
docker-nodered-node-red-1  | 
docker-nodered-node-red-1  | If the system-generated key is lost for any reason, your credentials
docker-nodered-node-red-1  | file will not be recoverable, you will have to delete it and re-enter
docker-nodered-node-red-1  | your credentials.
docker-nodered-node-red-1  | 
docker-nodered-node-red-1  | You should set your own key using the 'credentialSecret' option in
docker-nodered-node-red-1  | your settings file. Node-RED will then re-encrypt your credentials
docker-nodered-node-red-1  | file using your chosen key the next time you deploy a change.
docker-nodered-node-red-1  | ---------------------------------------------------------------------
docker-nodered-node-red-1  | 
docker-nodered-node-red-1  | 14 Mar 15:10:36 - [info] Waiting for missing types to be registered:
docker-nodered-node-red-1  | 14 Mar 15:10:36 - [info]  - OpcUa-Server
arol-varesi commented 1 year ago

ON Node-RED 3.0.1 it works

This is the install log:

-----------------------------------------------------------
2023-03-14T14:13:41.353Z Install : node-red-contrib-opcua 0.2.300

2023-03-14T14:13:41.364Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-opcua@0.2.300
2023-03-14T14:13:41.921Z [err] npm
2023-03-14T14:13:41.921Z [err]  WARN config production Use `--omit=dev` instead.
2023-03-14T14:14:01.912Z [out] 
2023-03-14T14:14:01.912Z [out] added 174 packages in 20s
2023-03-14T14:14:01.936Z rc=0
mikakaraila commented 1 year ago

This is causing the problem: No such built-in module: node:stream/promises

It is used in the node-opcua-file-transfer: import { pipeline } from "node:stream/promises";

Some kind of nodejs version incompatibility. @erossignon any ideas?

arol-varesi commented 1 year ago

I suppose is something changed last 2 days. I had some defined procedure to install devices. And only on devices installed yesterday this probles has arised. Today I tryed to reinstall a device installed last week (working) and reinstalling today it has the problem. Very very strange.

Thank you for your support, I will try to update my nodeRED (that probably will have impact on other libraries), but I hope this thread can be useful if someone else will have same problem.

mikakaraila commented 1 year ago

If you had earlier version of node-red-contrib-opcua it can be it didn´t contain file-transfer (OPC UA File object). Current: Node.js version: v14.18.2 Solution: Need to make sure your node version is > v15

mikakaraila commented 1 year ago

Etienne has updated node-opcua github workflow: image

erossignon commented 1 year ago

image

arol-varesi commented 1 year ago

Gotcha.

Using the node-red docker image 2.1.6-16 based on node 16 will work!!!

Thankyou

erossignon commented 1 year ago

node 12 is deprecated, node 14 end of life is Feb 2023, it is time to switch to nodejs >= 16 https://endoflife.date/nodejs