我有一个Web服务器,当我使用Node或Nodemon(例如“nodemon index.js”)时可以正常工作。但是,当我尝试使用pm2(“pm2 start index.js”)时,我得到“SyntaxError:Unexpected token import”。下面是完整的错误日志。我在这里做错了什么?
/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:29
import(process.env.pm_exec_path);
^^^^^^
SyntaxError: Unexpected token import
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._compile (internal/modules/cjs/loader.js:618:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
at startup (internal/bootstrap/node.js:201:19)