Can't install appium via npm command

I am sorry in advance if the error is a node.js issue, not an appium issue, but still I would be happy to get an answer

C:\Users\asihi\AppData\Roaming\npm>node -v
v16.8.0

C:\Users\asihi\AppData\Roaming\npm>npm -v
6.9.0

C:\Users\asihi\AppData\Roaming\npm>appium -v
‘appium’ is not recognized as an internal or external command,
operable program or batch file.

npm WARN npm npm does not support Node.js v16.8.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can’t make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
npm WARN npm You can find the latest version at
npm ERR! cb.apply is not a function

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\asihi\AppData\Roaming\npm-cache_logs\2021-09-02T14_19_38_024Z-debug.log

The debug log attached :

0 info it worked if it ends with ok
1 warn npm npm does not support Node.js v16.8.0
2 warn npm You should probably upgrade to a newer version of node as we
3 warn npm can’t make any promises that npm will work with this version.
4 warn npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
5 warn npm You can find the latest version at
6 verbose cli [
6 verbose cli ‘C:\Program Files\nodejs\node.exe’,
6 verbose cli ‘C:\Users\asihi\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js’,
6 verbose cli ‘install’,
6 verbose cli ‘-g’,
6 verbose cli ‘appium’
6 verbose cli ]
7 info using [email protected]
8 info using [email protected]
9 verbose npm-session 789b3d4a7759912e
10 silly install loadCurrentTree
11 silly install readGlobalPackageData
12 warn registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ETIMEDOUT: request to https://registry.npmjs.org/appium failed, reason: connect ETIMEDOUT 104.16.22.35:443
13 warn registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
14 http fetch GET 200 https://registry.npmjs.org/appium 133221ms (from cache)
15 silly pacote tag manifest for appium@latest fetched in 133251ms
16 verbose stack TypeError: cb.apply is not a function
16 verbose stack at C:\Users\asihi\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:285:20
16 verbose stack at FSReqCallback.oncomplete (node:fs:199:5)
17 verbose cwd C:\Users\asihi\AppData\Roaming\npm
18 verbose Windows_NT 10.0.19043
19 verbose argv “C:\Program Files\nodejs\node.exe” “C:\Users\asihi\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js” “install” “-g” “appium”
20 verbose node v16.8.0
21 verbose npm v6.9.0
22 error cb.apply is not a function
23 verbose exit [ 1, true ]

I did a search on the error that you had bolded. Here is the first answer, which seems to have a bunch of different solutions:

If you don’t find anything that works, use your favorite search engine to do a web search on that term. Looks like a fairly common NPM issue. Good Luck.