wechat-bot@1.0.0 dev /root/self/wechat-bot
node ./index.js
(node:1166) ExperimentalWarning: The ESM module loader is experimental.
file:///root/self/wechat-bot/src/wechaty/sendMessage.js:16
const roomName = (await room?.topic()) || null // 群名称
^
SyntaxError: Unexpected token '.'
at Loader.moduleStrategy (internal/modules/esm/translators.js:117:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wechat-bot@1.0.0 dev: node ./index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wechat-bot@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-02-11T18_22_03_997Z-debug.log
操作系统:Centos 7 node版本:v12.19.1 npm版本:v6.14.8
问题描述: npm run dev启动服务失败,报错信息如下:
[root@fancy-box-2 wechat-bot]# npm run dev
wechat-bot@1.0.0 dev /root/self/wechat-bot node ./index.js
(node:1166) ExperimentalWarning: The ESM module loader is experimental. file:///root/self/wechat-bot/src/wechaty/sendMessage.js:16 const roomName = (await room?.topic()) || null // 群名称 ^
SyntaxError: Unexpected token '.' at Loader.moduleStrategy (internal/modules/esm/translators.js:117:18) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! wechat-bot@1.0.0 dev:
node ./index.js
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the wechat-bot@1.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2023-02-11T18_22_03_997Z-debug.log