"Error: Cannot find module 'extend'

Hi everyone,

I'm pretty new to Node-RED and I am working on a project with Augmented Operator Advisor by Schneider Electric to send MySQL data to the AOA app on a Tablet device. I followed up the installation of the AOA nodes (Unzip node-red-augmented-operator.zip in \node_modules folder is all it says in the readme file), but whenever I try to deploy my flows or start up node-red I keep getting the same error message. Below you will find the cmd prompt after I start up node-RED. I have double checked and the files that are showing in the error message are all in their respective folders and when I check the palettes in Node-RED it is showing the node-red-augmentedoperator nodes in there. I think I am lacking a critical step in the installation of the module but I can't figure out what, sadly there's not more documentation I can rely on for the installation of this particular AOA module. I haven't installed anything through NPM. Thank you very much in advance.

Your environment has been set up for using Node.js 16.13.1 (x64) and npm.

C:\Users\omers>node-red
9 Dec 08:52:00 - [info]

Welcome to Node-RED
===================

9 Dec 08:52:00 - [info] Node-RED version: v2.1.4
9 Dec 08:52:00 - [info] Node.js  version: v16.13.1
9 Dec 08:52:00 - [info] Windows_NT 10.0.19042 x64 LE
9 Dec 08:52:00 - [info] Loading palette nodes
9 Dec 08:52:01 - [info] Settings file  : C:\Users\omers\.node-red\settings.js
9 Dec 08:52:01 - [info] Context store  : 'default' [module=memory]
9 Dec 08:52:01 - [info] User directory : \Users\omers\.node-red
9 Dec 08:52:01 - [warn] Projects disabled : editorTheme.projects.enabled=false
9 Dec 08:52:01 - [info] Flows file     : \Users\omers\.node-red\flows.json
9 Dec 08:52:01 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

9 Dec 08:52:01 - [info] Server now running at http://127.0.0.1:1880/
9 Dec 08:52:01 - [info] Starting flows
9 Dec 08:52:01 - [error] [Augmented-Operator-server:43072a22be5f998b] Error: Cannot find module 'extend'
Require stack:
- C:\Users\omers\.node-red\node_modules\node-red-augmented-operator\node_modules\request\index.js
- C:\Users\omers\.node-red\node_modules\node-red-augmented-operator\node-red-augmentedoperator.js
- C:\Users\omers\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\loader.js
- C:\Users\omers\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\registry\lib\index.js
- C:\Users\omers\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\nodes\index.js
- C:\Users\omers\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\index.js
- C:\Users\omers\AppData\Roaming\npm\node_modules\node-red\lib\red.js
- C:\Users\omers\AppData\Roaming\npm\node_modules\node-red\red.js
9 Dec 08:52:01 - [error] [mysql:Mysql localhost -testdb] MySQL database not configured
9 Dec 08:52:01 - [error] [mysql:Mysql localhost -testdb] MySQL database not configured
9 Dec 08:52:01 - [info] Started flows

Hi @Omer

Welcome to the forum.

That doesn't appear to be a node in the public Flow Library. Do you have a link to it anywhere?

Unzipping the module file is not a good way to install node modules. It won't get added to your package.json file and the module will be removed the next time you install anything with npm.

Hiya,

Thank you very much for the swift reply!
Here's the URL to the nodes AOA Nodes

I figured just unzipping it into the folder wouldnt be the right way/sufficient, but sadly that's all the readme file stated and since I'm pretty much a beginner I couldn't think of any other way.

I would suggest installing it this way:

  1. unzip node-red-augmented-operator.zip into a separate directory
  2. in your .node-red directory, run npm install <path to where you unzipped the file>

That will install the module and ensure its dependencies are properly installed as well.

1 Like

After installing as @knolleary's suggestion, don't delete where you have unzipped it to, as node_modules links to that folder.

You may be able to work around the missing module by going to your .node-red folder and running
npm install extend
Then restart node-red. Whether the node will work is another matter.

1 Like

No - that will cause npm to remove node-red-augmented-operator because it hadn't been added to the package.json file.

1 Like

Thank you very much @knolleary it worked.
You guys are awesome, I had been on this for a few days :slight_smile:
Have a nice rest of your week & stay healthy!

I did say to do that after installing the package as in your instructions.

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