docker-http-mqtt-bridge
docker-http-mqtt-bridge copied to clipboard
SyntaxError: Unexpected token import
When starting the container I see this error repeating in the logs
mqttbridge | 2022-03-11T04:58:28: PM2 log: App [HTTP-To-MQTT-Bridge:0] starting in -fork mode-
mqttbridge | 2022-03-11T04:58:28: PM2 log: App [HTTP-To-MQTT-Bridge:0] online
mqttbridge | /usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:30
mqttbridge | import(url.pathToFileURL(process.env.pm_exec_path));
mqttbridge | ^^^^^^
mqttbridge | SyntaxError: Unexpected token import
mqttbridge | at createScript (vm.js:80:10)
mqttbridge | at Object.runInThisContext (vm.js:139:10)
mqttbridge | at Module._compile (module.js:617:28)
mqttbridge | at Object.Module._extensions..js (module.js:664:10)
mqttbridge | at Module.load (module.js:566:32)
mqttbridge | at tryModuleLoad (module.js:506:12)
mqttbridge | at Function.Module._load (module.js:498:3)
mqttbridge | at Function.Module.runMain (module.js:694:10)
mqttbridge | at startup (bootstrap_node.js:204:16)
mqttbridge | at bootstrap_node.js:625:3
mqttbridge | 2022-03-11T04:58:28: PM2 log: App [HTTP-To-MQTT-Bridge:0] exited with code [1] via signal [SIGINT]
I haven't made any changes to the container config which was working previously so I think it might be an issue with the latest image. Thanks!
This project downloads the latest version of pm2, which doesn't support the 9.x version of Node this project uses.
You can change the Dockerfile to install the old version of pm2 like this:
RUN npm install [email protected] -g
... then build the docker file and use that image.
OR, you can just use the image I built that does exactly that: rsteckler/docker-http-mqtt-bridge:v1