我正在尝试运行“node server.js”以通过 Azure IoT Hub 将我的树莓派设备连接到 Azure。当我运行命令“node server.js”时,我收到以下错误。请注意,我将计算机的用户名替换为“用户名”。文件 connection_string.js 中没有我的计算机的用户名,尽管错误提示它有。请看下面的错误:
SyntaxError: Invalid flags supplied to RegExp constructor '*username*'
at new RegExp (native)
at Object.<anonymous> (/Users/*username*/iot-hub-c-raspberrypi-getstartedkit/command_center_node/node_modules/azure-iot-common/lib/connection_string.js:9:31)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/*username*/iot-hub-c-raspberrypi-getstartedkit/command_center_node/node_modules/azure-iot-common/common.js:15:21)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/*username*/iot-hub-c-raspberrypi-getstartedkit/command_center_node/server.js:7:15)
预先感谢您的帮助!