npm ERR! cb.apply is not a function

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

[root@jumpbox webssh]# 

 

Resolution

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 issue: https://github.com/nodejs/node/issues/34162#issuecomment-652575905

Take the following steps:

  1. Make sure that you're running npm >= 6 on your local machine. (This comes by default with Node 12 and 14.)
  2. Run npm install and check in any changes to the package-lock.json.
  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. 
5 (1)
Article Rating (1 Votes)
Rate this article
    Attached Files
    There are no attachments for this article.