Skip to Content

npm ERR! cb.apply is not a function

Resolving "npm ERR! cb.apply is not a function" Error in Ezeelogin


Overview: This article addresses the npm ERR! cb.apply is not a function error when installing node modules for the browser-based SSH client in Ezeelogin. The issue arises from a conflict between older npm versions and newer Node.js versions. The solution is to upgrade npm version to higher, ensure compatibility with Node.js, and adjust the package.json configuration as needed.


Getting the error  "npm ERR! cb.apply is not a function " when trying to install node modules to get  browser based ssh client working in Ezeelogin.

[root@jumpbox webssh]#  npm install --production

npm ERR! Linux 3.10.0-1127.18.2.el7.x86_64

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--production"

npm ERR! node v14.11.0

npm ERR! npm v4.3.0

 

npm ERR! cb.apply is not a function

npm ERR!

npm ERR! If you need help, you may report this error at:

npm ERR!     <https://github.com/npm/npm/issues>

 

npm ERR! Please include the following file with any support request:

npm ERR!     /root/.npm/_logs/2020-10-07T11_22_39_029Z-debug.log

This is a conflict between npm <= 5 and newer versions of Node 12 and 14. The solution is to upgrade npm to >= 6, which is installed with Node 12 and Node 14 by default.

More details are described in this GitHub issuehttps://github.com/nodejs/node/issues/34162#issuecomment-652575905

Take the following steps:

Step 1. Make sure that you're running npm >= 6 on your local machine. (This comes by default with Node 12 and 14.)

Step 2. Run npm install and check in any changes to the package-lock.json.

Step 3. Remove the "npm" key from the "engines" in package.json. The buildpack will simply use the version of npm that comes with your set version of Node. For example, both Node 12.18.3 and 14.6.0 are installed with npm 6.14.6. 


Related Articles

How to install node using npm and n module?

Install node on different OS

Node process fails to start with Error: Cannot find module ’express’