0

statusonline我运行后所示pm2 start index.js
但是一旦我调用 API,它就会返回ERR_REQUIRE_ESM.

我尝试修复:

  1. 将 index.js 文件重命名为 index.mjs 并运行pm2 start index.mjs
  2. 安装esm包并运行pm2 start ecosystem.config.js

生态系统.config.js

module.exports = {
  apps : [{
    name: 'backend',
    script: 'index.js',
    instances: 1,
    autorestart: true,
    watch: true,
    max_memory_restart: '1G',
    env: {
      NODE_ENV: 'development'
    },
    env_production: {
      NODE_ENV: 'production'
    }
  }]
};

这两种方法都失败了。

4

0 回答 0