Testing a node locally


#1

Rather than publishing my new node, I followed the node-red packaging guide to test the node locally, but I can't get it to display in my node-RED palette, and seeing strange npm behaviour.
npm v6.4.1
node-RED v 0.19.5
Node.js version: v8.12.0

I made a few early mistakes initially by calling the node 'node-red-contrib-RFM69Pi-Decoder' (note upper-case), but later changed it to 'node-red-contrib-rfm69pi-decoder'. However, when I try and link the node, I get;

pi@raspberrypi:~/.node-red $ npm install /home/pi/testnode/node-red-contrib-rfm69pi-decoder
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.
+ node-red-contrib-rfm69pi-decoder@0.0.2
added 3 packages from 1 contributor and audited 1425 packages in 54.756s
found 23 vulnerabilities (3 low, 12 moderate, 8 high)
  run `npm audit fix` to fix them, or `npm audit` for details

...which looks good, but after a NR stop/start, the node does not appear in the palette, and if I look in ~/.node-red/node_modules, I see;
nr - NOTE - node-red-contrib-RFM69Pi-Decoder.

So I deleted both 'node-red-contrib-RFM69Pi-Decoder' & 'node-red-contrib-rfm69pi-decoder' and cleaned the npm cache -npm cache clean --force and tried again, and got exactly the same result.

Where is it getting 'node-red-contrib-RFM69Pi-Decoder' from?? It's not mentioned in any of my node files, and why isn't my node displayed in the palette?


#2

Is node-red-contrib-RFM69Pi-Decoder still mentioned in your package.json ? If you didn't use npm remove to remove it, then it will still be in your package.json file and npm will be reinstalling it for you.


#3

No, it is not mentioned.

No, I didn't use npm remove, so manually remove the entry from .node-red/package.json?


#4

We may have crossed our wires on which package.json I was referring to in my first question. I was asking about .node-red/package.json. If it is mentioned in that file, remove it.


#5

That has sorted the package.json issue OK, thanks.

However my node is still not being displayed in the palette.
I've npm removed it, and npm re-installed it, and the node-red-log now shows;

11 Jan 10:27:35 - [warn] [node-red-contrib-rfm69pi-decoder/rfm69pi-decoder] SyntaxError: missing ) after argument list

Do you know which file this error refers to, or is it a case of again hunting for a syntax error throughout all of the node's files


#6

It will be under whatever rfm69pi-decoder points at in your package.json.

Your IDE ought to help you find a syntax error in the file - it isn't a runtime error.


#7

Thanks, found it found them!
Silly errors that I should have spotted earlier.