FreePBX 16 - UCP Node not runnung

Hello, my dears,
I installed FreePBX 16 with Asterisk 16 on Debian 11. I can successfully access my FreePBX Admin Dashboard.

However, I get a critical error. This reads as follows in the dashboard: “UCP Node is not running”. In the “ucp_error.log” I see the following error messages:

2023-05-18 12:14 +02:00: Error: Cannot find module 'mariasql'
2023-05-18 12:14 +02:00: Require stack:
2023-05-18 12:14 +02:00: - /var/www/html/admin/modules/ucp/node/lib/freepbx.js
2023-05-18 12:14 +02:00: - /var/www/html/admin/modules/ucp/node/index.js
2023-05-18 12:14 +02:00:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
2023-05-18 12:14 +02:00:     at Module.Hook._require.Module.require (/var/www/html/admin/modules/pm2/node/node_modules/require-in-the-middle/index.js:81:25)
2023-05-18 12:14 +02:00:     at require (internal/modules/cjs/helpers.js:74:18)
2023-05-18 12:14 +02:00:     at Object.<anonymous> (/var/www/html/admin/modules/ucp/node/lib/freepbx.js:11:15)
2023-05-18 12:14 +02:00:     at Module._compile (internal/modules/cjs/loader.js:999:30)
2023-05-18 12:14 +02:00:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
2023-05-18 12:14 +02:00:     at Module.load (internal/modules/cjs/loader.js:863:32)
2023-05-18 12:14 +02:00:     at Function.Module._load (internal/modules/cjs/loader.js:708:14)
2023-05-18 12:14 +02:00:     at Module.require (internal/modules/cjs/loader.js:887:19)
2023-05-18 12:14 +02:00:     at Module.Hook._require.Module.require (/var/www/html/admin/modules/pm2/node/node_modules/require-in-the-middle/index.js:101:39) {
2023-05-18 12:14 +02:00:   code: 'MODULE_NOT_FOUND',
2023-05-18 12:14 +02:00:   requireStack: [
2023-05-18 12:14 +02:00:     '/var/www/html/admin/modules/ucp/node/lib/freepbx.js',
2023-05-18 12:14 +02:00:     '/var/www/html/admin/modules/ucp/node/index.js'
2023-05-18 12:14 +02:00:   ]
2023-05-18 12:14 +02:00: }

Can you help me? What can I do?

Greetings from Stefan Harbich

UCP’s node service has older dependencies so you will have to downgrade node if you want to use it. FreePBX distro has node v8.16.0. Alternatively, you can use UCP without the node service.

1 Like

Hello, how can I use UCP without node service?

Yeah… very similar message I encountered a couple of weeks ago…
I guess you need to downgrade the NodeJS version.
Hopefully below helps.

Hello, I’ve read that the Nodej version can be stepped down with the command “nvm install version number”. Did someone try it out?

I tried nvm, but it wasn’t working well on Rocky Linux 9 platform, so I am using n version manager instead.

How would the version manager be the complete command to downgrade?

Hello, I downgraded to nodejs version 8.16.0 with the command “n 8.16.0”. Unfortunately the error still exists. In the logging I see a different message now:

2023-05-19 08:35 +02:00: SyntaxError: Unexpected token import
2023-05-19 08:35 +02:00:     at createScript (vm.js:80:10)
2023-05-19 08:35 +02:00:     at Object.runInThisContext (vm.js:139:10)
2023-05-19 08:35 +02:00:     at Module._compile (module.js:617:28)
2023-05-19 08:35 +02:00:     at Object.Module._extensions..js (module.js:664:10)
2023-05-19 08:35 +02:00:     at Module.load (module.js:566:32)
2023-05-19 08:35 +02:00:     at tryModuleLoad (module.js:506:12)
2023-05-19 08:35 +02:00:     at Function.Module._load (module.js:498:3)
2023-05-19 08:35 +02:00:     at Function.Module.runMain (module.js:694:10)
2023-05-19 08:35 +02:00:     at startup (bootstrap_node.js:204:16)
2023-05-19 08:35 +02:00:     at bootstrap_node.js:625:3
2023-05-19 08:35 +02:00: /var/www/html/admin/modules/pm2/node/node_modules/pm2/lib/ProcessContainerFork.js:30
2023-05-19 08:35 +02:00:     import(url.pathToFileURL(process.env.pm_exec_path));
2023-05-19 08:35 +02:00:     ^^^^^^

Do you have another tip for me?

Version 8 didn’t work for me as well, as I mentioned, 10.24.1 worked for me, but it could be different scenario for you. have you done fwconsole ma downloadinstall ucp to force reinstall the module?

1 Like

Hello, I was able to solve the problem with the following commands:

apt remove nodejs
apt install nodejs
fwconsole ma download ucp
fwconsole ma install ucp
fwconsole reload
systemctl restart freepbx.service

Greetings from Stefan Harbich

2 Likes

Congrats! For my case, RL9 came with version 18 of NodeJS, I needed to downgrade for ucp to work, but if you can stick to the host server’s package manager, that’s the best! :smiling_face:

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