Hilscher Community Forum
Error when using a node 'OpcUaServer' - Printable Version

+- Hilscher Community Forum (https://forum.hilscher.com)
+-- Forum: netPI 3 - Docker featuring Industrial Raspberry Pi 3 platform (https://forum.hilscher.com/forum-1.html)
+--- Forum: Software (https://forum.hilscher.com/forum-5.html)
+--- Thread: Error when using a node 'OpcUaServer' (/thread-586.html)



Error when using a node 'OpcUaServer' - tad - May-11th-2020

Dear Armin,

This may be a simple question(?)

- Once I removed all containers.
- I just added hilschernetpi/netpi-nodered.

- I used a node 'OpcUa-Server' and then I got an error as attached.

"Error: get-installed-path: module not found "node-opcua-server" in path /usr/lib/node_modules/node-red-contrib-opcua/node-opcua-server"

Note: I found node-opcua-server in /usr/lib/node_modules/node-red-contrib-opcua/node_modules/node-opcua-server.

I created a meaningful data flow, but this error did not still go away.
If you can guess the possible problems, I would appreciate your advice.
Thank you very much for your support.
Best regards,


RE: Error when using a node 'OpcUaServer' - Armin@netPI - May-11th-2020

I see the same error.

It seems to be a problem also others had in year 2019. See this issue here https://github.com/mikakaraila/node-red-contrib-opcua/issues/110.

They are reporting the same issue but with Node-RED version 0.20.3. The problem has been corrected meanwhile in the source code as I read the answer of the developer in the ticket.

Our Node-RED container uses Node-RED in the version 1.0.6 and node.js in the version v12.16.3. Maybe this Node-RED and node.js combo let show the error again. In our container the node-red-contrib-version 0.2.49 is installed by default but also the latest version node-red-contrib-version 0.2.52 shows the same error.

I went into the source code of version 0.2.52. https://github.com/mikakaraila/node-red-contrib-opcua/blob/master/opcua/104-opcuaserver.js in accordance to the issue https://github.com/mikakaraila/node-red-contrib-opcua/issues/110 at line 85 to see if the correction was done and I see it was indeed corrected ...


Code:
    var serverPkg = installedPath.getInstalledPathSync('node-opcua-server', {
    paths: [
         path.join(__dirname, '..'),
        path.join(__dirname, '../..'),
         path.join(process.cwd(), './node_modules'),
         path.join(process.cwd(), '.node-red/node_modules'),
     ],
})


I think this needs more investiation. If this is a bug then I have to report this as an issue to the developer

Thx
Armin


RE: Error when using a node 'OpcUaServer' - Armin@netPI - May-11th-2020

I found the problem. The list of search paths is incomplete in the source code of the OPC-UA node.

I had to install another line in the list of path where the node has to look for the server node.

Code:
var serverPkg = installedPath.getInstalledPathSync('node-opcua-server', {
    paths: [
         path.join(__dirname, '..'),
          path.join(__dirname, '../..'),
         path.join(process.cwd(), './node_modules'),
   --->       path.join(process.cwd(), '../node_modules'), <----
         path.join(process.cwd(), '.node-red/node_modules'),
     ],

Then it works. This is a bug and I have to repot it to the developer and raise an issue.

I cannot solve it myself for everybody sind it is a bug. You can edit the source code yourself in the container.

Thx
Arminn


RE: Error when using a node 'OpcUaServer' - tad - May-11th-2020

Dear Armin,

Thank you very much for your quick investigation/feedback.
I don't have enough knowledge to edit the source code so that I wait for a while.

Best regards,


RE: Error when using a node 'OpcUaServer' - Armin@netPI - May-11th-2020

I raised an issue in the source code project https://github.com/mikakaraila/node-red-contrib-opcua/issues/148 that describes the problem. I hope it will be corrected soon.

But there is a work around for you meanwhile. You can update the installed version 0.2.49 with the new version 0.2.52 if you use the "manage palette" function in Node-RED top right menu. Enter in "nodes" the term "opcua" and then press update. when it is finished restart the container and then it will work.

Thx
Armin


RE: Error when using a node 'OpcUaServer' - Armin@netPI - May-11th-2020

I got confirmation from development team that the fix has been applied to the source code already.

But there is no release yet. They want to wait for other bugs and collect before they release a new version.

So we have to wait.

Thx
Armin


RE: Error when using a node 'OpcUaServer' - tad - May-12th-2020

Dear Armin,

I was able to update the node-red-contrib-opcua with the new version 0.2.52 according to your suggestion!
I really appreciate your kind support.

Now my opc-ua server is running without errors so far.

Best regards,