Documentation: testing a node module locally

I have found two different recipes for this in the NR documentation, one at
[https://nodered.org/docs/creating-nodes/packaging]
and the other at
[https://nodered.org/docs/creating-nodes/first-node].
I have had success with the second but not the first. The one given under Packaging appears to be the instructions from Creating your first node for older versions of npm, except that npm link is used instead of ln -s or mklink. It might be a good idea to smooth out the differences and put the information in just one place, with cross-references if needed.

When you say you haven’t had success with the instructions under packaging, do you mean you had to use ln or mklink rather than npm link? What version of npm were you using and on what platform?

Given how quickly npm is moving, I’d expect npm link to work for most users now.

Sorry I wasn’t clear about what I did. I tried the Packaging instructions, which mention only npm link. IIRC, I ended up with a link to somewhere odd, possibly /usr/bin. I may also have made an error specifying <name of node module>, possibly as file not a directory. I tried this at various times over the past year or so, running current Raspbian and npm versions.

In any case, I simply cleaned up the mess and went back to putting .js and .html files in a subdirectory of ~./node-red/nodes. Very recently I found the other set of directions and had success with npm install, so I can’t say whether npm link would work for me.

npm link creates an intermediary link that I personally find unnecessary and confusing.

When I’m developing a new node, I simply create a new GitHub repo, clone it to my dev PC in my development folder (e.g. not under node-red) then manually create a link from the dev folder to the correct location under my userDir.

for example, if I created a new node called node-red-contrib-myidea, it would be cloned to something like c:\src\node-red-contrib-myidea and then I would create a softlink from there to ~/.node-red/node_modules/node-red-contrib-myidea (note that the tilde for your home folder only works under PowerShell on Windows).

This works perfectly well and npm handles linked folders just fine. It means that I don’t have to mess with doing npm update when changing my code - though, of course, you still have to restart Node-RED.