I'm developing a node-contrib module that creates a few nodes for network communication. After writing it all up, I get an error message on node-red startup:
25 Mar 23:34:26 - [warn] [node-red-contrib-my-client/my-client] Error: Cannot find module 'my-client'
The first npm package I installed is 'node-red-contrib-my-client', following the instructions in the docs and a similar existing (and working) package. It requires 'my-client' as dependency which does the actual network protocol handling.
I've installed the contrib package with 'npm i C:\path\to\node-red-contrib-my-client' and it has created a link to my dev directory under node_modules. Looks good. That dev directory also has 'node_modules\my-client' in it. But I get the error message. Even when I install the dependency directly to node-red with 'npm i C:\path\to\my-client', it creates a second directory as a link, but it doesn't help.
What have I done wrong?
node-red 0.20.0 on Windows 10. The Node-RED GUI works and I see the nodes from the other package I installed. It has dependencies, too, as my package. But mine fails to load.
PS: Node-RED's debug and trace logging isn't helpful. It lists my contrib package among others but then shows the error message. I have no idea where this thing is looking for the files but it's the wrong place.
Update: The error message seems to come from this line in my contrib module:
module.exports = function (RED) {
"use strict";
var events = require("events");
var MyClient = require("my-client"); // <----- ERROR
...
When I set that variable to null, the error goes away, but the code will not work without it. When I set the string to "../my-client", as specified in the package.json, it also doesn't work.
Both of my packages are not published on npmjs, I only have them on my local machine because both are still in development. But it seems npm isn't made for development, it's just good for consumption of already published packages.