Node process fails to start with Error: Cannot find module ’express’
Resolving 'Cannot find module 'express' Error in Browser-based SSH Client
Overview: This article describes how to resolve the 'Cannot find module 'express'' error in a browser-based SSH Client by installing the necessary module using npm.
The Browser-based SSH Client not working and keeps getting the below error when running the webssh node application.
:~# PORT=22222 node --tls-min-v1.0 /var/www/ezlogin/application/external/webssh/index.js
Error:
Error: Cannot find module 'express'
Require stack:
- /var/www/ezlogin/application/external/webssh/server/app.js
- /var/www/ezlogin/application/external/webssh/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/var/www/ezlogin/application/external/webssh/server/app.js:11:15)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/var/www/ezlogin/application/external/webssh/server/app.js',
'/var/www/ezlogin/application/external/webssh/index.js'
]
1. Install the module to resolve the above error.
:~# cd /var/www/ezlogin/application/external/webssh/ && npm install --production --silent --no-audit
Note:If you are getting the error "npm ERR! cb.apply is not a function", Refer article. Make sure the npm version is >= 6.