Adding nodes to node-red

Home Forums Conduit: AEP Model Adding nodes to node-red

Tagged: ,

Viewing 12 posts - 31 through 42 (of 42 total)
  • Author
    Posts
  • #16352
    Heath Raftery
    Participant

    Unfortunately that config file is mysterious. It has been deprecated in node-red but the conduit is stuck on an old version, so it’s hard to understand how it’s supposed to work.

    A couple of things to check:

    1. What are your .config.json permissions? It’s a long shot, but I guess it needs to be writable by admin. Mine are: -rw-r--r-- admin root
    2. Have you waited a long time after rebooting? node-red takes many minutes to start. I guess you have if you can see the palette.
    3. Try watching /var/log/app/node-red.log as node-red starts. Normally there’s not much to see (only “Loading palette nodes” seems to be relevant) but maybe yours is showing an error.
    4. Try killing Node-RED, and then running it from the command line with /opt/node-red/bin/node-red-pi. You’ll see a bunch of stuff appear on the command line which may include something useful.
    5. As a last resort, could you try modifying .config.json yourself? It’s not pretty, but it doesn’t seem too hard to guess what should appear in there.

    Hopefully something in the logs/command line will help. Might it’s just be a dependancy or a file write issue. It’s tricky to work with though.

    #16354
    Jeffrey Osborne
    Participant

    I’m going to jump into this conversation as I’m having the same issue and not sure how to resolve it.

    I am trying to add a node, specifically a mysql node). I attempted the following:

    1) Copy and past the 68-mysql.html and 68-mysql.json files from the above link to /opt/node-red/nodes/core/storage. Restarted the Conduit, but the mySQL node was not added. I looked at the .config file, and it was updated to include the 68-mysql files. The entry looks like:
    `”mysql”: {
    “name”: “mysql”,
    “types”: [
    “MySQLdatabase”,
    “mysql”
    ],
    “enabled”: true,
    “module”: “node-red”,
    “file”: “/opt/node-red/nodes/core/storage/68-mysql.js”
    }`

    2) I tried to add this node via npm (I SSH’d into the Conduit using PuTTY). I did the following
    cd /opt/node-red/nodes
    npm install node-red-node-mysql
    From that, I got the following error`npm WARN package.json mts-gpio@ No description

    npm WARN package.json mts-gpio@ No repository field.
    npm WARN package.json mts-gpio@ No README data
    npm WARN package.json mts-mcard@ No description
    npm WARN package.json mts-mcard@ No repository field.
    npm WARN package.json mts-mcard@ No README data
    npm WARN package.json mts-serial@ No description
    npm WARN package.json mts-serial@ No repository field.
    npm WARN package.json mts-serial@ No README data
    npm ERR! network getaddrinfo ENOTFOUND
    npm ERR! network This is most likely not a problem with npm itself
    npm ERR! network and is related to network connectivity.
    npm ERR! network In most cases you are behind a proxy or have bad network settings.
    npm ERR! network
    npm ERR! network If you are behind a proxy, please make sure that the
    npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
    
    npm ERR! System Linux 3.12.27
    npm ERR! command "node" "/usr/bin/npm" "install" "node-red-node-mysql"
    npm ERR! cwd /opt/node-red/nodes
    npm ERR! node -v v0.10.40
    npm ERR! npm -v 1.4.28
    npm ERR! syscall getaddrinfo
    npm ERR! code ENOTFOUND
    npm ERR! errno ENOTFOUND
    npm ERR!
    npm ERR! Additional logging details can be found in:
    npm ERR!     /opt/node-red/nodes/npm-debug.log
    npm ERR! not ok code 0

    And alas, the node hasn’t been added to node-red on the Conduit :(. Anyone know what is the cause of this?

    #16359
    Heath Raftery
    Participant

    I’m pretty sure you need the package.json file as well as the other two. Otherwise the entry in .config.json looks good. Anything in /var/log/app/node-red.log ?

    #16373
    Jason Reiss
    Keymaster

    npm ERR! network getaddrinfo ENOTFOUND
    npm ERR! network This is most likely not a problem with npm itself
    npm ERR! network and is related to network connectivity.

    Is the device connected to the internet?

    Does this command succeed to resolve the address?
    > nslookup google.com

    #16394
    Jeffrey Osborne
    Participant

    Response to Heath Raftery:

    I placed package.json in /opt/node-red/nodes/core/storage, and restarted the Conduit, but that didn’t fix the issue. Here is my node-red.log:

    18 Jan 19:26:16 - [info] Node-RED version: v0.11.1
    18 Jan 19:26:16 - [info] Node.js  version: v0.10.40
    18 Jan 19:26:16 - [info] Loading palette nodes
    18 Jan 19:27:32 - [warn] ------------------------------------------
    18 Jan 19:27:32 - [warn] Failed to register 1 node type
    18 Jan 19:27:32 - [warn] Run with -v for details
    18 Jan 19:27:32 - [warn] ------------------------------------------
    18 Jan 19:27:32 - [info] Settings file  : /var/config/app/install/development/settings.js
    18 Jan 19:27:32 - [info] User directory : /var/config/app/install/development
    18 Jan 19:27:32 - [info] Flows file : /var/config/app/install/development/flows.json
    18 Jan 19:27:33 - [info] Server now running at http://127.0.0.1:1881/
    18 Jan 19:27:33 - [info] Creating new flow file
    18 Jan 19:27:33 - [info] Starting flows
    18 Jan 19:27:33 - [info] Started flows

    Response to Jason Reiss:

    It is yeah, but I’m getting the following error when I execute nslookup google.com:

    Server:    127.0.0.1
    Address 1: 127.0.0.1 localhost.localdomain
    
    nslookup: can't resolve 'google.com'

    Which leads me to believe that I’m not connected to the internet…which doesn’t seem right.

    #16395
    Heath Raftery
    Participant

    18 Jan 19:27:32 – [warn] Failed to register 1 node type
    18 Jan 19:27:32 – [warn] Run with -v for details

    Great! Did you try? You could kill node-red and then run /opt/node-red/bin/node-red-pi, perhaps with -v, for details. Or, now that I look at package.json and see this:

    “dependencies” : {
    “mysql” : “^2.12.0”
    },

    I’m going to have a red hot guess and say you haven’t installed mysql. That’s something npm does for you – takes care of dependencies.

    Which leads me to believe that I’m not connected to the internet…which doesn’t seem right.

    What makes you think you’re connected to the Internet? Your results certainly suggest otherwise. Interesting that Martijn Jonker had the same issue. Is it possible you’ve both been tricked into thinking you’ve connected your Conduits to the Internet?

    Check the output of ifconfig, ping google.com and ping 172.217.25.174. If you can’t figure it out, I suggest starting a new thread on connecting the Conduit to the internet.

    #16407
    Eliz
    Participant

    Hi all

    thanks for the advice. I managed to install the node I wanted in the end! A few things that happened to me that might help someone –

    1. I tried installing a package/node that I only realized had a pre-requisite for node red 0.14.0 after a few hours
    2. When using npm install while in the /opt/node-red/node_modules directory it did’t work but when installing in /opt/node-red/nodes it worked and the node also then appeared in the config file and under node_modules
    3. I was rebooting node red endlessly cause I misread originally – you actually have to reboot the conduit!

    #16436
    Jeffrey Osborne
    Participant

    Response to Heath

    I was able to connect it to the internet, that was one of the issues. For others: I didn’t have my gateway and DNS configured. When I execute ping google.com I get the following:

    PING google.com (216.58.219.206) 56(84) bytes of data.
    64 bytes from lga25s40-in-f14.1e100.net (216.58.219.206): icmp_seq=1 ttl=56 time=20.3 ms
    64 bytes from lga25s40-in-f14.1e100.net (216.58.219.206): icmp_seq=2 ttl=56 time=20.4 ms

    I then executed npm install node-red-node-mysql in /opt/node-red/nodes, and it appeared to work correctly. In /opt/node-red/node_modules I now see node-red-node-mysql. However, it still does not appear in node-red after restarting the conduit.

    Some additional information. Inside of node-red.log, I have the following:

    Welcome to Node-RED
    ===================
    
    23 Jan 17:21:10 - [info] Node-RED version: v0.11.1
    23 Jan 17:21:10 - [info] Node.js  version: v0.10.40
    23 Jan 17:21:10 - [info] Loading palette nodes
    23 Jan 17:25:53 - [warn] ------------------------------------------
    23 Jan 17:25:53 - [warn] Failed to register 1 node type
    23 Jan 17:25:53 - [warn] Run with -v for details
    23 Jan 17:25:53 - [warn] ------------------------------------------
    23 Jan 17:25:53 - [info] Settings file  : /var/config/app/install/development/settings.js
    23 Jan 17:25:53 - [info] User directory : /var/config/app/install/development
    23 Jan 17:25:53 - [info] Flows file : /var/config/app/install/development/flows.json
    23 Jan 17:25:54 - [info] Server now running at http://127.0.0.1:1881/
    23 Jan 17:25:54 - [info] Creating new flow file
    23 Jan 17:25:55 - [info] Starting flows
    23 Jan 17:25:55 - [info] Started flows

    So it looks like there is still an issue with the node. When I execute /opt/node-red/bin/node-red-pi -v I get an error regarding already using the ports. I don’t have node-red open when I execute this, not sure what causes this:

    Welcome to Node-RED
    ===================
    
    23 Jan 18:25:22 - [info] Node-RED version: v0.11.1
    23 Jan 18:25:22 - [info] Node.js  version: v0.10.40
    23 Jan 18:25:22 - [info] Loading palette nodes
    23 Jan 18:26:53 - [info] Settings file  : /opt/node-red/settings.js
    23 Jan 18:26:54 - [info] User directory : /home/root/.node-red
    23 Jan 18:26:54 - [info] Flows file : /home/root/.node-red/flows_mtcdt.json
    23 Jan 18:26:54 - [warn] Communication server error: Error: listen EADDRINUSE
    23 Jan 18:26:54 - [error] Unable to listen on http://127.0.0.1:1880/
    23 Jan 18:26:54 - [error] Error: port in use

    Still unable to get the mySQL node into node-red, any thoughts?

    #16437
    Jeffrey Osborne
    Participant

    One last thing I just realized. In my npm-debug file, I have the following:

    0 info it worked if it ends with ok
    1 verbose cli [ 'node', '/usr/bin/npm', 'install', 'node-red-node-mysql' ]
    2 info using npm@1.4.28
    3 info using node@v0.10.40
    4 verbose cache add [ 'node-red-node-mysql', null ]
    5 verbose cache add name=undefined spec="node-red-node-mysql" args=["node-red-node-mysql",null]
    6 verbose parsed url { protocol: null,
    6 verbose parsed url   slashes: null,
    6 verbose parsed url   auth: null,
    6 verbose parsed url   host: null,
    6 verbose parsed url   port: null,
    6 verbose parsed url   hostname: null,
    6 verbose parsed url   hash: null,
    6 verbose parsed url   search: null,
    6 verbose parsed url   query: null,
    6 verbose parsed url   pathname: 'node-red-node-mysql',
    6 verbose parsed url   path: 'node-red-node-mysql',
    6 verbose parsed url   href: 'node-red-node-mysql' }
    7 silly makeCacheDir cache dir uid, gid [ 0, 0 ]
    8 silly lockFile dbd87e05-node-red-node-mysql node-red-node-mysql
    9 verbose lock node-red-node-mysql /home/root/.npm/dbd87e05-node-red-node-mysql.lock
    10 silly lockFile dbd87e05-node-red-node-mysql node-red-node-mysql
    11 silly lockFile dbd87e05-node-red-node-mysql node-red-node-mysql
    12 verbose addNamed [ 'node-red-node-mysql', '' ]
    13 verbose addNamed [ null, '*' ]
    14 silly lockFile 313b7776-node-red-node-mysql node-red-node-mysql@
    15 verbose lock node-red-node-mysql@ /home/root/.npm/313b7776-node-red-node-mysql.lock
    16 silly addNameRange { name: 'node-red-node-mysql', range: '*', hasData: false }
    17 verbose request where is /node-red-node-mysql
    18 verbose request registry https://registry.npmjs.org/
    19 verbose request id e85f32bedf8a2218
    20 verbose url raw /node-red-node-mysql
    21 verbose url resolving [ 'https://registry.npmjs.org/', './node-red-node-mysql' ]
    22 verbose url resolved https://registry.npmjs.org/node-red-node-mysql
    23 verbose request where is https://registry.npmjs.org/node-red-node-mysql
    24 info trying registry request attempt 1 at 23:09:10
    25 http GET https://registry.npmjs.org/node-red-node-mysql
    26 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND
    27 info trying registry request attempt 2 at 23:09:22
    28 http GET https://registry.npmjs.org/node-red-node-mysql
    29 info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND
    30 info trying registry request attempt 3 at 23:10:22
    31 http GET https://registry.npmjs.org/node-red-node-mysql
    32 silly lockFile 313b7776-node-red-node-mysql node-red-node-mysql@
    33 silly lockFile 313b7776-node-red-node-mysql node-red-node-mysql@
    34 error network getaddrinfo ENOTFOUND
    34 error network This is most likely not a problem with npm itself
    34 error network and is related to network connectivity.
    34 error network In most cases you are behind a proxy or have bad network settings.
    34 error network
    34 error network If you are behind a proxy, please make sure that the
    34 error network 'proxy' config is set properly.  See: 'npm help config'
    35 error System Linux 3.12.27
    36 error command "node" "/usr/bin/npm" "install" "node-red-node-mysql"
    37 error cwd /
    38 error node -v v0.10.40
    39 error npm -v 1.4.28
    40 error syscall getaddrinfo
    41 error code ENOTFOUND
    42 error errno ENOTFOUND
    43 verbose exit [ 1, true ]
    #16439
    Heath Raftery
    Participant

    When I execute /opt/node-red/bin/node-red-pi -v I get an error regarding already using the ports

    Ah… you can’t run two instances. You have to stop node-red first. Just uncheck the “enabled” button in Node-RED apps in the web admin interface.

    In my npm-debug file, I have the following:

    That’s just the old network error message. I’m sure since you’ve fixed that that the npm-debug file is old.

    #16440
    Jeff Hatch
    Keymaster

    Jeffrey,

    To run node-red on the AEP Conduit you should use /etc/init.d/node-red start/stop. The node-red-pi program is for running it on a raspberry pi or similar Linux system. Due to a lot of different constraints, Node-RED on Conduit runs Node-RED with a different set of arguments than node-red-pi.

    Also, when you are starting Node-RED with node-red-pi, the ports already in use error probably means that there is an instance of Node-RED running already.

    For the getaddrinfo ENOTFOUND errors, can you do an nslookup on registry.npmjs.org and get a result like the following?

    `# nslookup registry.npmjs.org
    Server: 205.171.3.65
    Address 1: 205.171.3.65 resolver.qwest.net

    Name: registry.npmjs.org
    Address 1: 151.101.48.162′

    Jeff

    #16441
    Jeffrey Osborne
    Participant

    I think I got this working. I’m honestly not sure what I did to solve it, but since my last message I unticked “enable”, restarted the conduit, and tried re-installing the node via npm install node-red-node-mysql and it worked.

    When it doubt..turn it off and on…

Viewing 12 posts - 31 through 42 (of 42 total)
  • You must be logged in to reply to this topic.