Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capacitor CLI Version Error in Ionic. What to do?

I'm trying to add android platform to an Ionic (Angular) project.

ionic capacitor add android

It recognizes ionic capacitor add and requests me to select a platform.

? What platform would you like to add? (Use arrow keys)
> android
  ios

But as soon as I select the android platform I get this error.

? What platform would you like to add? android
[ERROR] Error while getting Capacitor CLI version.

        'capacitor' is not recognized as an internal or external command,
        operable program or batch file.

What is the problem and what do I do? Any help is appreciated. Thank you.

like image 699
Siddharth Narsipur Avatar asked Mar 10 '26 10:03

Siddharth Narsipur


2 Answers

Are you sure that you have installed the capacitor?

If not, you can add it using:

npm install @capacitor/core

npm install @capacitor/cli --save-dev

npx cap init

https://capacitorjs.com/docs/getting-started

like image 153
Andrei Fara Avatar answered Mar 12 '26 00:03

Andrei Fara


Just run:

npm install @capacitor/core @capacitor/cli
like image 35
ahmnouira Avatar answered Mar 12 '26 00:03

ahmnouira