MeshCentral-ScriptTask
MeshCentral-ScriptTask copied to clipboard
Error instantiating new plugin: Error: Cannot find module 'mongodb
While trying to install the plugin (any plugin) in meshcentral running in Docker (Dockerfile from MC repo), I got the following:
Error instantiating new plugin: Error: Cannot find module 'mongodb'
Require stack:
- /opt/meshcentral/meshcentral-data/plugins/scripttask/db.js
- /opt/meshcentral/meshcentral-data/plugins/scripttask/scripttask.js
- /opt/meshcentral/meshcentral/pluginHandler.js
- /opt/meshcentral/meshcentral/meshcentral.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.module.exports.CreateDB (/opt/meshcentral/meshcentral-data/plugins/scripttask/db.js:254:7)
at Object.obj.server_startup (/opt/meshcentral/meshcentral-data/plugins/scripttask/scripttask.js:38:85)
at Timeout._onTimeout (/opt/meshcentral/meshcentral/pluginHandler.js:427:146)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/opt/meshcentral/meshcentral-data/plugins/scripttask/db.js',
'/opt/meshcentral/meshcentral-data/plugins/scripttask/scripttask.js',
'/opt/meshcentral/meshcentral/pluginHandler.js',
'/opt/meshcentral/meshcentral/meshcentral.js'
]
}
I resolved it by copying
/opt/meshcentral/meshcentral/node_modules to /opt/meshcentral/meshcentral-data/plugins/
Of course this is not a permanent solution, and I'd like to ask if it's possible to update plugins, to resolve node_modules from the original path. Or is this something that meshcentral has to fix?