【发布时间】:2021-04-22 13:54:40
【问题描述】:
我正在尝试使用以下命令在 pm2 的开发模式下运行 Strapi:
pm2 start npm --name myprojectname -- run develop
不幸的是,我收到以下错误
0|edtech-a | SyntaxError: Unexpected token ':' 0|edtech-a | at wrapSafe (internal/modules/cjs/loader.js:979:16) 0|edtech-a | at Module._compile (internal/modules/cjs/loader.js:1027:27) 0|edtech-a | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) 0|edtech-a | at Module.load (internal/modules/cjs/loader.js:928:32) 0|edtech-a | at Function.Module._load (internal/modules/cjs/loader.js:769:14) 0|edtech-a | at Object.<anonymous> (C:\Users\dimit\AppData\Roaming\npm\node_modules\pm2\lib\ProcessContainerFork.js:33:23) 0|edtech-a | at Module._compile (internal/modules/cjs/loader.js:1063:30) 0|edtech-a | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) 0|edtech-a | at Module.load (internal/modules/cjs/loader.js:928:32) 0|edtech-a | at Function.Module._load (internal/modules/cjs/loader.js:769:14)
- PM2 版本为 4.5.1
- NodeJS 版本为 14.15.4
- NPM 版本为 6.13.2
- Strapi 版本是 3.1.0-alpha.5
当我尝试通过生态系统.config.json 文件在开发模式下运行 Strapi 时,我也遇到了同样的错误。
有人遇到过这个问题吗,如果是,我该如何解决?
【问题讨论】:
-
在没有pm2的情况下运行项目,是否正常运行?
-
@HasipTimurtas 是的,我正常运行时没有问题。
-
你能告诉我你是怎么正常运行的吗?当您尝试
npm run develop时,它工作正常吗? -
我使用 yarn develop,但是是的,它工作正常。
-
好的,检查我更新的答案,运行 yarn 命令。