About launching meteor using pm2 [@babel/runtime npm package could not be found]

Hello.

I’m currently building a production environment using Docker containers.

When running Meteor using PM2, an error is displayed and it does not start. (node_module @babel / runtime could not be found).

14:33:47 PM2           | App [Myservice:0] starting in -cluster mode-
14:33:47 1|Myservice  | Error:
14:33:47 1|Myservice  | The @babel/runtime npm package could not be found in your node_modules
14:33:47 1|Myservice  | directory. Please run the following command to install it:
14:33:47 1|Myservice  |   meteor npm install --save @babel/runtime
14:33:47 1|Myservice  |     at babel-runtime.js (packages/babel-runtime.js:20:9)
14:33:47 1|Myservice  |     at fileEvaluate (packages/modules-runtime.js:336:7)
14:33:47 1|Myservice  |     at Module.require (packages/modules-runtime.js:238:14)
14:33:47 1|Myservice  |     at require (packages/modules-runtime.js:258:21)
14:33:47 1|Myservice  |     at packages/babel-runtime.js:53:15
14:33:47 1|Myservice  |     at packages/babel-runtime.js:58:3
14:33:47 1|Myservice  |     at /var/www/html/aphrodite/bundle/programs/server/boot.js:398:38
14:33:47 1|Myservice  |     at Array.forEach (<anonymous>)
14:33:47 1|Myservice  |     at /var/www/html/aphrodite/bundle/programs/server/boot.js:226:21
14:33:47 1|Myservice  |     at /var/www/html/aphrodite/bundle/programs/server/boot.js:461:7
2020-03-24T14:33:47: PM2 log: App name:Myservice id:1 disconnected
14:33:47 PM2           | App name:Myservice id:1 disconnected
2020-03-24T14:33:47: PM2 log: App [Myservice:1] exited with code [0] via signal [SIGINT]
14:33:47 PM2           | App [Myservice:1] exited with code [0] via signal [SIGINT]
2020-03-24T14:33:47: PM2 log: App [Myservice:1] starting in -cluster mode-
14:33:47 PM2           | App [Myservice:1] starting in -cluster mode-
2020-03-24T14:33:47: PM2 log: App [Myservice:0] online
14:33:47 PM2           | App [Myservice:0] online
2020-03-24T14:33:47: PM2 log: App [Myservice:1] online
14:33:47 PM2           | App [Myservice:1] online

At this time, I think that there is no missing because babel-runtime is included in both global and local node_modules. . .

If you have encountered any similar events, please share your information! :slight_smile:

Meteor: 1.8.2
npm: 6.4.1

IIRC I had the same problem a while ago and fixed it by adding this line into process.json:

"interpreter": "node@12.14.0",

(set the Version to whatever Meteor 1.8.2 uses)

1 Like

Thank you it worked ! (And fixed the npm path…)

@Mizuki0414 I’m wondering if you can share some document or link regarding how to deploy Meteor with PM2. Thanks.

install pm2 on your server and set up your process.json like this:

{
  "apps": [
    {
      "name": "ProjectName",
      "interpreter": "node@12.14.0",
      "script": "../bundle/main.js",
      "exec_mode": "fork",
      "env": {
        "PORT": 3000,
        "MONGO_URL": "mongodb://127.0.0.1:27017/dbname",
        "MONGO_OPLOG_URL" : "mongodb://127.0.0.1:27017/local?replicaSet=rs0",
        "ROOT_URL": "http://server-name.com:3000",
        "METEOR_SETTINGS": {
            "test": "Test 12 12"
        }
      }
    }
  ]
}

then you build your meteor bundle on the server and start the pm2 process. For that I have these two skripts in my package.json:

    "build": "meteor build ../ --directory && cd ../bundle/programs/server && npm i",
    "start-production": "pm2 start process.json"
1 Like