Installing packed tgz file results on Error: Cannot find module

I have created a package with a custom node, the node lives on a nodes folder and I reference it on my package.json as:

  "node-red": {
    "nodes": {
      "configurable-countdown-timer": "nodes/configurable-countdown-timer.js"
    }
  },

when I pack it with npm pack I get this folder structure (that looks correct to me)

But when I upload it to my node-red test or live instances, I get this error:

node-red-tester  | 13 Apr 15:01:38 - [info] Installing module: @saninn/node-red-nodes, version: 0.0.1
node-red-tester  | 13 Apr 15:01:39 - [info] Installed module: @saninn/node-red-nodes
node-red-tester  | 13 Apr 15:01:39 - [warn] [@saninn/node-red-nodes/configurable-countdown-timer] Error: Cannot find module '/data/node_modules/@saninn/node-red-nodes/nodes/configurable-countdown-timer.js'
node-red-tester  | Require stack:
node-red-tester  | - /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
node-red-tester  | - /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
node-red-tester  | - /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
node-red-tester  | - /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
node-red-tester  | - /usr/src/node-red/node_modules/node-red/lib/red.js
node-red-tester  | - /usr/src/node-red/node_modules/node-red/red.js

But if I see inside my data (mapped as a local user-dir folder into docker) I see that it exists:

So I do not understand what is failing here. Any ideas?

 "node-red": {
    "nodes": {
      "configurable-countdown-timer": "nodes/configurable-countdown-timer.js"
    }
  },

Just a very quick observation, but should that be - according to your directory structure

 "node-red": {
    "nodes": {
      "configurable-countdown-timer": "nodes/configurable-countdown-timer/configurable-countdown-timer.js"
    }
  },

the nodes location is relative to the project root folder.

let me palm face to my self! Thank you!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.