Facing issues while building apk

I initially had cordova 8.0.0. when trying to run ionic cordova run android I faced the following issue.

Ionic build fails with Error: Cannot find module ‘…/cordova/platform_metadata’

I followed this thread Ionic build fails with Error: Cannot find module '../cordova/platform_metadata' and downgraded to 7.1.0

Now am facing different issue as follows

TypeError: Class extends value undefined is not a constructor or null

Can somebody help me how to resolve this?

What is your ionic info output?

The following one… I installed cordova globally but it doesn’t show up

cli packages: (C:\Users\my_user\node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

System:

Node : v7.4.0
npm  : 5.6.0
OS   : Windows 7

Misc:

backend : legacy

You have to run the command in your project directory.

Here is the ionic info output from my project directory

cli packages: (D:\sample\ionic\project_name\node_modules)

@ionic/cli-utils  : 1.10.2
ionic (Ionic CLI) : 3.10.3

global packages:

Cordova CLI : 8.0.0

local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms  : android 6.2.3 ios 4.4.0
Ionic Framework    : ionic-angular 3.6.1

System:

Node : v7.4.0
npm  : 5.6.0
OS   : Windows 7

Your app scripts version is too old. Try updating it.

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: How to update Cordova CLI, Platforms and Plugins · ionic.zone