Installed custom node not recognized in Node-red 1.3.1

In my previous setup (node-red 1.2.x), I used to install custom nodes (provided by someone else) by unzipping the node files in C:\Users\MyName\node_modules, and it was working fine :slight_smile:
Note: My machine is always offline, so I need to install these nodes in offline mode.
Since I upgraded to node-red 1.3.1, these nodes generate an error:

9 Apr 11:15:14 - [info]
Welcome to Node-RED
9 Apr 11:15:14 - [info] Node-RED version: v1.3.1
9 Apr 11:15:14 - [info] Node.js  version: v10.20.1
9 Apr 11:15:14 - [info] Windows_NT 10.0.19041 x64 LE
9 Apr 11:15:16 - [info] Loading palette nodes
9 Apr 11:15:16 - [error] Failed to start server:
9 Apr 11:15:16 - [error] TypeError: Cannot read property 'node-red-augmentedoperator' of undefined
    at C:\Users\MyName\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\localfilesystem.js:200:35
    at Array.forEach (<anonymous>)
    at scanTreeForNodesModules (C:\Users\MyName\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\localfilesystem.js:194:17)
    at Object.getNodeFiles (C:\Users\MyName\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\localfilesystem.js:334:27)
    at load (C:\Users\MyName\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\loader.js:42:35)
    at process._tickCallback (internal/process/next_tick.js:68:7)

I have found a workaround: unzip the files somewhere and then call npm install <path_to_node>

But, why doesn't it work like before?

Where is your Node-RED user directory located? Is there a package.json file in that directory?

I think that error will happen if there is no package.json existing in that directory, which could happen if you just unzip the module and then run node-red. Running the npm install will generate the package.json if it doesn't exist.

I've managed to recreate and this was the issue.

The workaround is either run npm install as you do, or if you unzip it, then run npm init -y in your Node-RED user directory (~/.node-red) in order to create a default package.json file.

I'll fix the underlying issue for 1.3.2

Actually its a bit more than that - the package.json needs to exist and have a dependencies section - something npm init -y won't give you.

Thanks for your feedback and waiting for 1.3.2 :slight_smile:

I confirm that the issue is fixed in 1.3.2
Thanks a lot and congratulation for your reactivity

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