Ionic cordova platform ls - throws error Invalid data, chunk must be a string or buffer, not object

D:\Demos\myAngularApp>ionic cordova platform ls
√ Creating .\www directory for you - done!
> cordova platform ls
Installed platforms:

Available platforms:
  android ~7.0.0
  browser ~5.0.1
  ios ~4.5.4
  osx ~4.0.1
  windows ~5.0.0
  www ^3.12.0
net.js:704
    throw new TypeError(
    ^

TypeError: Invalid data, chunk must be a string or buffer, not object
    at WriteStream.Socket.write (net.js:704:11)
    at process.<anonymous> (C:\Users\WD\AppData\Roaming\npm\node_modules\ionic\bin\ionic:9:63)
    at emitTwo (events.js:126:13)
    at process.emit (events.js:214:7)
    at emitPendingUnhandledRejections (internal/process/promises.js:108:22)
    at process._tickCallback (internal/process/next_tick.js:189:7)

I am getting the same error!
No response found yet?!

[ERROR] An error occurred while running subprocess ionic-app-scripts.

    ionic-app-scripts build --prod --target cordova --platform android exited with exit code 3.

    Re-running this command with the --verbose flag may provide more information.

net.js:704
throw new TypeError(
^

TypeError: Invalid data, chunk must be a string or buffer, not object
at WriteStream.Socket.write (net.js:704:11)
at process. (C:\Users\drnvs\AppData\Roaming\npm\node_modules\ionic\bin\ionic:9:63)
at emitTwo (events.js:126:13)
at process.emit (events.js:214:7)
at emitPendingUnhandledRejections (internal/process/promises.js:108:22)
at process._tickCallback (internal/process/next_tick.js:189:7)

Please take a look at this thread: Ionic info is not showing cordova platform. One user gave as solution “cordova globally not installed”. In my case, a re-install of 3 plugins fixed the problem. Might be worth trying for your environment!

I’ve got this issue since I updated to ionic version 4 yesterday. I can’t even use $ ionic. Is there any solution.

are you using fcm plugin?? Because it generally occurs when using FCM plugin.

I need to work on new project so I start ionic and I cant even start.

try to remove platform and re-add it.

I’m getting this error whenever I type ionic or ionic -v or ionic info. Any ideas on what’s going on? I have ionic@4.1.2 but it was happening with ionic@4.2.1 as well.

bash-3.2$ ionic
net.js:701
    throw new TypeError(
    ^

TypeError: Invalid data, chunk must be a string or buffer, not object
bash-3.2$ ionic info
net.js:701
    throw new TypeError(
    ^

TypeError: Invalid data, chunk must be a string or buffer, not object