How do I solve “Ionic build error mismatch for module”?

I am getting this error when trying to build my Ionic app

ionic-app-script task: "build" 
Error: Metadata version mismatch for module.../node_modules/@ionic-native/geolocation/index.d.ts, found version 4, expected 3 

This is happening for a few of the plugins like native/geolocation and facebook4.

Here is my ionic info

Ionic:

   ionic (Ionic CLI)  : 4.2.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 2.1.3

Cordova:

   cordova (Cordova CLI) : 6.5.0
   Cordova Platforms     : android 6.1.2
   Cordova Plugins       : no whitelisted plugins (23 plugins total)

System:

   ios-deploy : 1.9.2
   NodeJS     : v9.4.0 (/usr/local/Cellar/node/9.4.0/bin/node)
   npm        : 5.10.0
   OS         : macOS
   Xcode      : Xcode 10.0 Build version 10A255

Has anyone had this error? Please assist

First thing you could try is to delete your node_modules folder and execute: npm i

I’ve tried that a few times as well as removing and adding platforms