Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type error runtime.pm2.web is not a function after updateing to 4.0.0 #4449

Closed
ahyari opened this issue Oct 14, 2019 · 22 comments
Closed

type error runtime.pm2.web is not a function after updateing to 4.0.0 #4449

ahyari opened this issue Oct 14, 2019 · 22 comments
Labels

Comments

@ahyari
Copy link

ahyari commented Oct 14, 2019

What's going wrong?

after updating to pm2@4.0.0 my application start giving an error "TypeError: Runtime.pm2.web is not a function"
full stack trace:

`[WARN] PM2 Daemon is already running
/usr/local/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:121
Runtime.pm2.web(port);
^

TypeError: Runtime.pm2.web is not a function
at /usr/local/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:121:23
at autodump (/usr/local/lib/node_modules/pm2/lib/API.js:335:23)
at API.CLI.autodump (/usr/local/lib/node_modules/pm2/lib/API/Startup.js:403:12)
at that._startJson (/usr/local/lib/node_modules/pm2/lib/API.js:334:14)
at /usr/local/lib/node_modules/pm2/lib/API.js:1084:23
at /usr/local/lib/node_modules/pm2/lib/API.js:1162:21
at wrapper (/usr/local/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
at iterateeCallback (/usr/local/lib/node_modules/pm2/node_modules/async/internal/eachOfLimit.js:63:24)
at /usr/local/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
at /usr/local/lib/node_modules/pm2/lib/API.js:1157:11`

How could we reproduce this issue?

update to pm2@4.0.0

Supporting information

In-memory PM2 is out-of-date, do:
$ pm2 update
In memory PM2 version: 3.5.1
Local PM2 version: 4.0.1

--- PM2 report ----------------------------------------------------------------
Date                 : Mon Oct 14 2019 12:33:55 GMT+0200 (Central European Summer Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 3.5.1
node version         : 10.16.3
node path            : /usr/local/bin/pm2
argv                 : /usr/local/Cellar/node@10/10.16.3/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : ahmadalhyari
uid                  : 501
gid                  : 20
uptime               : 3min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 4.0.1
node version         : 10.16.3
node path            : /usr/local/bin/pm2
argv                 : /usr/local/Cellar/node@10/10.16.3/bin/node,/usr/local/bin/pm2,report
argv0                : node
user                 : ahmadalhyari
uid                  : 501
gid                  : 20
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : darwin
type                 : Darwin
cpus                 : Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
cpus nb              : 12
freemem              : 19365888
totalmem             : 17179869184
home                 : /Users/ahmadalhyari
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬─────────────────────────┬─────────┬─────────┬──────────┬────────┬──────┬──────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name                    │ version │ mode    │ pid      │ uptime │ ↺    │ status   │ cpu      │ mem      │ user     │ watching │
├────┼─────────────────────────┼─────────┼─────────┼──────────┼────────┼──────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│ 0  │ app                     │ 0.0.1   │ cluster │ 0        │ 0      │ 9    │ errored  │ 0%       │ 0b       │ ahm… │ disabled │
│ 1  │ app                     │ 0.0.1   │ cluster │ 0        │ 0      │ 9    │ errored  │ 0%       │ 0b       │ ahm… │ disabled │
└────┴─────────────────────────┴─────────┴─────────┴──────────┴────────┴──────┴──────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/Users/ahmadalhyari/.pm2/pm2.log last 20 lines:
PM2        | 2019-10-14T12:32:11: PM2 log: App [app:1] starting in -cluster mode-
PM2        | 2019-10-14T12:32:11: PM2 log: App [app:0] exited with code [1] via signal [SIGINT]
PM2        | 2019-10-14T12:32:11: PM2 log: Script /Users/ahmadalhyari/reposotiry/api/container-peak-api/src/bin/www.js had too many unstable restarts (10). Stopped. "errored"
PM2        | 2019-10-14T12:32:11: PM2 log: App [app:1] online
PM2        | internal/modules/cjs/loader.js:638
PM2        |     throw err;
PM2        |     ^
PM2        | 
PM2        | Error: Cannot find module 'newrelic'
PM2        |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
PM2        |     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
PM2        |     at Module.require (internal/modules/cjs/loader.js:692:17)
PM2        |     at Module._preloadModules (internal/modules/cjs/loader.js:901:12)
PM2        |     at preloadModules (internal/bootstrap/node.js:601:7)
PM2        |     at startup (internal/bootstrap/node.js:273:9)
PM2        |     at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
PM2        | 2019-10-14T12:32:11: PM2 log: App name:app id:1 disconnected
PM2        | 2019-10-14T12:32:11: PM2 log: App [app:1] exited with code [1] via signal [SIGINT]
PM2        | 2019-10-14T12:32:11: PM2 log: Script /Users/ahmadalhyari/reposotiry/api/container-peak-api/src/bin/www.js had too many unstable restarts (10). Stopped. "errored"
PM2        | 2019-10-14T12:32:11: PM2 error: Cancelling versioning data parsing

@rmiaas
Copy link

rmiaas commented Oct 21, 2019

Same issue here, had to go back to the last working version 3.5.1.

@rvlasyuk
Copy link

rvlasyuk commented Nov 4, 2019

Hey, any updates about this issue? Still reproducing in pm2@4.1.2

@linegel
Copy link

linegel commented Nov 5, 2019

We have encounter same issue, nothing previous builds stopped to work with the latest (1 day ago) update of docker image keymetrics/pm2:8-stretch

@linegel
Copy link

linegel commented Nov 6, 2019

We solved issues for now by rollback pm2 to v3.5.1 as mentioned by @rmiaas, thanks for posing stable version!

@zanlucathiago
Copy link

@linegel, how did you solve that? I'm using keymetrics/pm2:8-alpine, and it broke after the update also. I can't find out where can i force a previous version of pm2.

@rmiaas
Copy link

rmiaas commented Nov 12, 2019

@zanlucathiago in your Dockerfile, you can do RUN npm install pm2@3.5.1 -g

@linegel
Copy link

linegel commented Nov 12, 2019

@zanlucathiago @rmiaas or you could do better and replace
FROM keymetrics/pm2:8-alpine
with
FROM node:8
and add as next line
RUN yarn global add pm2@3.5.1
So first lines of you Dockerfile will look like:

FROM node:8

RUN yarn global add pm2@3.5.1

# All other commands of you Dockerfile

Since it will remove the dependency, which showed a lack of stability and compatibility between versions of itself. And at the same time will prevent double installation of pm2
Hope answer will be helpful you :)

@laurenskling
Copy link

It's the --web flag that is crashing

@broql
Copy link

broql commented Apr 23, 2020

Still crashing (Mac).

pm2 --version
4.3.1

user@user-computer directory % pm2-runtime start ecosystem.config.js --web
/Users/user/.nvm/versions/node/v12.16.0/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:117
Runtime.pm2.web(port);
^

TypeError: Runtime.pm2.web is not a function
at /Users/user/.nvm/versions/node/v12.16.0/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:117:23
at /Users/user/.nvm/versions/node/v12.16.0/lib/node_modules/pm2/lib/API.js:335:23
at API.CLI.autodump (/Users/user/.nvm/versions/node/v12.16.0/lib/node_modules/pm2/lib/API/Startup.js:403:12)
at /Users/user/.nvm/versions/node/v12.16.0/lib/node_modules/pm2/lib/API.js:334:14
at /Users/user/.nvm/versions/node/v12.16.0/lib/node_modules/pm2/lib/API.js:1115:23
at /Users/user/.nvm/versions/node/v12.16.0/lib/node_modules/pm2/lib/API.js:1193:21
at wrapper (/Users/user/.nvm/versions/node/v12.16.0/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
at replenish (/Users/user/.nvm/versions/node/v12.16.0/lib/node_modules/pm2/node_modules/async/internal/eachOfLimit.js:76:25)
at /Users/user/.nvm/versions/node/v12.16.0/lib/node_modules/pm2/node_modules/async/internal/eachOfLimit.js:86:9
at eachLimit (/Users/user/.nvm/versions/node/v12.16.0/lib/node_modules/pm2/node_modules/async/eachLimit.js:47:43)

@stale
Copy link

stale bot commented May 23, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 23, 2020
@stale stale bot closed this as completed Jun 6, 2020
@wilensky
Copy link

wilensky commented Jun 18, 2020

PM2 v4.4.0 still an issue.

Node version v14.3.0

[xxx@zzz]$ pm2-runtime pm2.yml --web 9615
2020-06-18T15:38:50: PM2 log: Launching in no daemon mode
2020-06-18T15:38:51: PM2 log: App [tsc:0] starting in -fork mode-
2020-06-18T15:38:51: PM2 log: App [spa:1] starting in -fork mode-
2020-06-18T15:38:51: PM2 log: App [tsc:0] online
2020-06-18T15:38:51: PM2 log: App [spa:1] online
/xxx/node_modules/pm2/lib/binaries/Runtime4Docker.js:117
          Runtime.pm2.web(port);
                      ^

TypeError: Runtime.pm2.web is not a function

Any updates ❓

@rafabc
Copy link

rafabc commented Jun 26, 2020

pm2-runtime still have this issue, im running in version 4.4.0

TypeError: Runtime.pm2.web is not a function at /usr/local/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:117:23 at /usr/local/lib/node_modules/pm2/lib/API.js:342:23

@levicoradine
Copy link

pm2@4.5.4 FROM node:14-buster, using pm2-runtime "${PM2_ECOSYSTEM_FILE}" --web:

/usr/local/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:117
          Runtime.pm2.web(port);
                      ^

TypeError: Runtime.pm2.web is not a function
    at /usr/local/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:117:23
    at /usr/local/lib/node_modules/pm2/lib/API.js:334:21
    at /usr/local/lib/node_modules/pm2/lib/API.js:1099:23
    at /usr/local/lib/node_modules/pm2/lib/API.js:1177:21
    at wrapper (/usr/local/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
    at iterateeCallback (/usr/local/lib/node_modules/pm2/node_modules/async/internal/eachOfLimit.js:63:24)
    at /usr/local/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
    at /usr/local/lib/node_modules/pm2/lib/API.js:1172:11
    at /usr/local/lib/node_modules/pm2/node_modules/pm2-axon-rpc/lib/client.js:45:10
    at Parser.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/req.js:67:8)
root@cf85aae41171:/svcs-server# events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at process.target._send (internal/child_process.js:832:20)
    at process.target.send (internal/child_process.js:703:19)
    at IPCTransport.send (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/transports/IPCTransport.js:83:21)
    at IPCTransport.setOptions (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/transports/IPCTransport.js:73:21)
    at Function.configureModule (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/configuration.js:13:62)
    at NotifyFeature.init (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/features/notify.js:33:33)
    at FeatureManager.init (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/featureManager.js:81:21)
    at PMX.init (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/pmx.js:90:29)
    at Object.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/index.js:5:65)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
Emitted 'error' event on Worker instance at:
    at process.<anonymous> (internal/cluster/worker.js:30:12)
    at process.emit (events.js:315:20)
    at internal/child_process.js:836:39
    at processTicksAndRejections (internal/process/task_queues.js:75:11) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at process.target._send (internal/child_process.js:832:20)
    at process.target.send (internal/child_process.js:703:19)
    at IPCTransport.send (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/transports/IPCTransport.js:83:21)
    at IPCTransport.setOptions (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/transports/IPCTransport.js:73:21)
    at Function.configureModule (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/configuration.js:13:62)
    at NotifyFeature.init (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/features/notify.js:33:33)
    at FeatureManager.init (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/featureManager.js:81:21)
    at PMX.init (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/pmx.js:90:29)
    at Object.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/index.js:5:65)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
Emitted 'error' event on Worker instance at:
    at process.<anonymous> (internal/cluster/worker.js:30:12)
    at process.emit (events.js:315:20)
    at internal/child_process.js:836:39
    at processTicksAndRejections (internal/process/task_queues.js:75:11) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

@mspoerer
Copy link

@Unitech This is still not working. Please consider to reopen this issue. Can the community help to fix it? Some advise would be nice.

@sukkamehu
Copy link

/usr/local/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:117
          Runtime.pm2.web(port);
                      ^

TypeError: Runtime.pm2.web is not a function
    at /usr/local/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:117:23
    at /usr/local/lib/node_modules/pm2/lib/API.js:334:21
    at /usr/local/lib/node_modules/pm2/lib/API.js:1099:23
    at /usr/local/lib/node_modules/pm2/lib/API.js:1177:21
    at wrapper (/usr/local/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
    at iterateeCallback (/usr/local/lib/node_modules/pm2/node_modules/async/internal/eachOfLimit.js:63:24)
    at /usr/local/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
    at /usr/local/lib/node_modules/pm2/lib/API.js:1172:11
    at /usr/local/lib/node_modules/pm2/node_modules/pm2-axon-rpc/lib/client.js:45:10
    at Parser.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/req.js:67:8)

I got also this while

@Niek
Copy link

Niek commented Apr 15, 2021

Can confirm, same issue here.

Runtime.pm2.web(port);

Shouldn't this be this.pm2.web(port)?

@mashirozx
Copy link

mashirozx commented Nov 30, 2021

If you are going to use the docker health check, this command may help you:

pm2 jlist | jq '[.[]|select(.name=="process_name")][0]' | jq -r '.pm2_env' | jq -r '.status'

See my blog: https://story.moezx.cc/health-check-of-pm2-in-docker/

@earthpyy
Copy link

I'm having the same problem

@sk31park
Copy link

sk31park commented Mar 14, 2022

Anybody solve this problem?

@matheusleite
Copy link

I still have the same problem when running on AWS Elastic Beanstalk

@welljs
Copy link

welljs commented Oct 2, 2023

End of 2023 the same

2023-10-02T06:00:29: PM2 log: App [bot-backend:1] online
/usr/local/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:117
          Runtime.pm2.web(port);
                      ^
TypeError: Runtime.pm2.web is not a function
    at /usr/local/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:117:23
    at /usr/local/lib/node_modules/pm2/lib/API.js:330:21
    at /usr/local/lib/node_modules/pm2/lib/API.js:1096:23
    at /usr/local/lib/node_modules/pm2/lib/API.js:1174:21
    at wrapper (/usr/local/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
    at iterateeCallback (/usr/local/lib/node_modules/pm2/node_modules/async/internal/eachOfLimit.js:63:24)
    at /usr/local/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
    at /usr/local/lib/node_modules/pm2/lib/API.js:1169:11
    at /usr/local/lib/node_modules/pm2/node_modules/pm2-axon-rpc/lib/client.js:45:10
    at Parser.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/req.js:67:8)
Node.js v18.18.0

@Miindaugas
Copy link

Miindaugas commented Nov 5, 2023

5.3.0

/usr/local/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:117
          Runtime.pm2.web(port);
                      ^

TypeError: Runtime.pm2.web is not a function
    at /usr/local/lib/node_modules/pm2/lib/binaries/Runtime4Docker.js:117:23
    at /usr/local/lib/node_modules/pm2/lib/API.js:330:21
    at /usr/local/lib/node_modules/pm2/lib/API.js:1096:23
    at /usr/local/lib/node_modules/pm2/lib/API.js:1174:21
    at wrapper (/usr/local/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
    at iterateeCallback (/usr/local/lib/node_modules/pm2/node_modules/async/internal/eachOfLimit.js:63:24)
    at /usr/local/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
    at /usr/local/lib/node_modules/pm2/lib/API.js:1169:11
    at /usr/local/lib/node_modules/pm2/node_modules/pm2-axon-rpc/lib/client.js:45:10
    at Parser.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/req.js:67:8)

Node.js v18.18.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests