st-one-io / node-red-contrib-cip-ethernet-ip

A Node-RED node to interact with Allen Bradley / Rockwell PLCs
GNU General Public License v3.0
51 stars 26 forks source link

Unable to use it on Yocto #3

Closed laura-mc closed 5 years ago

laura-mc commented 6 years ago

I am able to install it, but once installed, it does not appear on nodes palette. Ethernet-ip module is installed.

gfcittolin commented 6 years ago

Hi, how have you installed it? through the command line or through Node-RED's interface? Have you tried restarting Node-RED and refreshing your browser after installing? This node has no external and/or native dependencies, therefore it should run on any environment where NodeJS runs

laura-mc commented 6 years ago

I have installed it through the command line, and I have restart node-red after installation. Nothing happens. When I try to enable the nodes, it says "Failed to enable ethernet-ip. Syntaxerror: Unexpected token"

gfcittolin commented 6 years ago

Then you're probably using an outdated version of NodeJS. The library we use under the cover uses modern Javascript code, so make sure you're using version 6.x or newer

EDIT: sorry, the library uses async functions, and this is supported only from version 7.x onwards

Paul1G commented 6 years ago

HI all, i have been advised that the issue is with the use of Spread Syntax (three dots "...") , this is not supported within older versions of yocto, I'm not a node.js expert, would anyone know how to amend this?

from what i can see in the file the Spread Syntax is used two times.

lines 18 and 267. some help would be appreciated

github.com cmseaton42/node-ethernet-ip/blob/master/src/controller/index.js

const { ENIP, CIP } = require("../enip"); const dateFormat = require("dateformat"); const TagGroup = require("../tag-group"); const { delay, promiseTimeout } = require("../utilities"); const Queue = require("task-easy");

const compare = (obj1, obj2) => { if (obj1.priority > obj2.priority) return true; else if (obj1.priority < obj2.priority) return false; else return obj1.timestamp.getTime() < obj2.timestamp.getTime(); };

class Controller extends ENIP { constructor() { super();

    this.state = {
        ...this.state,
        controller: {
            name: null,

This file has been truncated. show original

lines 18 and 267. some help would be appreciated

gfcittolin commented 6 years ago

Well, maybe an alternative would be to transpile the library using Babel or similar, so that newer constructions could be translated to a more traditional syntax. But then either we'd need to ask cmseaton42/node-ethernet-ip to be done there, or you could do it yourself locally.

I know nothing about Yocto, but isn't it possible to get a newer image with a newer version of Node.JS? I guess this would be the easiest way

gfcittolin commented 5 years ago

Closing due to lack of activity in the issue. Please feel free to reopen it if needed

su600 commented 5 years ago

@gfcittolin Hello! Have you test it on raspberry pi? I want to install it on Docker/nodered:rpi(nodered for raspberry),nodered 0.20, node.js 8.11. I have same issue, "I am able to install it, but once installed, it does not appear on nodes palette", it sames can't run on ARM Linux, it is ok on Docker/nodered Could you please help me figure what is the problem? How can I install it and run it on Docker/nodered:rpi, Thank you!

gfcittolin commented 5 years ago

It should be no problem to run it on raspberry pi, please try installing it from the "Manage Palette" menu of Node-RED. How have you installed it? What does the log says anything when installing it? Or does the Node-RED log say anything about not being able to run it?

su600 commented 5 years ago

@gfcittolin Hi,thanks for reply. My project is based on Node-Red Docker Container for raspberry pi, as Running under Docker

> docker run -it -p 1880:1880 --name mynodered nodered/node-red-docker:rpi

Note: on a Raspberry Pi you must use a rpi-tagged image: nodered/node-red-docker:rpi.

I have installed it both from the "Manage Palette" menu and npm install. The log is like this:

21 Aug 02:50:20 - [info] Installing module: node-red-contrib-cip-ethernet-ip, version: 1.0.2
21 Aug 02:50:41 - [info] Installed module: node-red-contrib-cip-ethernet-ip
21 Aug 02:50:42 - [info] Added node types:
21 Aug 02:50:42 - [info]  - node-red-contrib-cip-ethernet-ip:eth-ip endpoint : SyntaxError: Unexpected token ...
21 Aug 02:50:42 - [info]  - node-red-contrib-cip-ethernet-ip:eth-ip in : SyntaxError: Unexpected token ...
21 Aug 02:50:42 - [info]  - node-red-contrib-cip-ethernet-ip:eth-ip out : SyntaxError: Unexpected token ...

It has error of SyntaxError: Unexpected token, Once I deploy a "eth-ip" node, the nodes are missing, the error occurs:

21 Aug 02:51:24 - [info] Stopping flows
21 Aug 02:51:24 - [info] Stopped flows
21 Aug 02:51:24 - [info] Waiting for missing types to be registered:
21 Aug 02:51:24 - [info]  - eth-ip endpoint
21 Aug 02:51:24 - [info]  - eth-ip in

When refresh the browser, all eip-ip nodes disappear in the Palette

I have installed it on my raspberry pi locally and node-red Docker container:latest, and all work well, BUT error occurs on Node-red Docker container for raspberry Pi I think this problem should not happen, may be something wrong with Docker or just my problem? One more thing, what's the tag name rule, I have programed some Tags in PLC, such as program:mainprogram.aa, but node-red-contrib-cip-ethernet-ip can't find the Tag.

Could please test install it on node-red-docker:rpi and help me, Thank you!

gfcittolin commented 5 years ago

The "SyntaxError" on definitely shows that this docker image is using an old node.js version, as stated on other comments above. There's even nothing I can do, because this is not from our code base, but from a dependency of ours.

I suggest contacting the maintainers of the docker image you're using, or updating/creating a new one with an updated version of Node