NPX is giving npm ERR! cb.apply is not a function when making gz and br files

Whenever I try to run the following command to customize ELK 7.10.0
npx gzip-cli /usr/share/kibana/x-pack/plugins/security/target/public/security.chunk.4.js -e=gz -e=b
I got the following error.
npm ERR! cb.apply is not a function
I am using the following versions:
node js : v16.3.0
npm : 7.15.1
npx : 10.2.2

Please any one from this community guide me that how to resolve this error. Help will be appreciated

Delete the npm folder and if there is one npm cache folder.
Run npm clean cache —force ( — force is now required to clean cache)

or

Delete the npm folder and if there is one mom cache folder.
Run npm clean cache —force ( — force is now required to clean cache)
Make sure everything to do with Nodejs is deleted and uninstalled.
Reinstall Nodejs.

Try it and let us know if it works ...

cc @jbudz - for more inputs if any ?

thanks
Rashmi

I have tried the workaround that you have posted above but It does not works for me as When I again installed nodejs then It gave me the same error like before that cb.apply is not a function. I am using UBUNTU 18.04. Any other work around? if yes then please do share

Thanks
Mohammad Awais Javaid

I have overcome this issue by executing the following using nvm.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.bashrc
nvm install 8.10.0
nvm --version
npm i -g npx
nvm install 10.24.0

I think 10.24.0 version matches with 7.10.0 dependencies. This solution worked for me and I am using UBUNTU 18.04.