User8
User8

Reputation: 83

ionic platform error when adding android platform

I am trying to add android platform to ionic but when I add it keeps getting this error

Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: com.ionicframework.carmart632655
        Name: CarMart
        Activity: MainActivity
        Android target: android-23
Android project created with [email protected]
Installing "cordova-plugin-console" for android
Failed to install 'cordova-plugin-console':Error: cmd: Command failed with exit code ENOENT
    at ChildProcess.whenDone (C:\Users\UVINDU\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\cordova-common\src\superspawn.js:169:23)
    at emitOne (events.js:90:13)
    at ChildProcess.emit (events.js:182:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
    at onErrorNT (internal/child_process.js:344:16)
    at nextTickCallbackWith2Args (node.js:474:9)
    at process._tickCallback (node.js:388:17)Error: cmd: Command failed with exit code ENOENT

What is wrong with my installation

Upvotes: 1

Views: 5285

Answers (3)

Narendrakumar
Narendrakumar

Reputation: 163

Firstly uninstall node.js and reinstall freshly after that execute that following command.

ionic start {your project directory} --v2

Here one case i observed if you have any plugins required for your project try to install before adding platform, otherwise we are getting some error just like as below.

Failed to install 'cordova-plugin-console':Error: cmd: Command failed with exit code ENOENT at ChildProcess.whenDone (C:\Users\TestUser\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\cordova-common\src\superspawn.js:169:23) at emitOne (events.js:90:13) at ChildProcess.emit (events.js:182:7) at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) at onErrorNT (internal/child_process.js:344:16) at nextTickCallbackWith2Args (node.js:474:9) at process._tickCallback (node.js:388:17)Error: cmd: Command failed with exit code ENOENT.

once plugin's installation done try to add platform it should work.

Make sure that to avoid the below error, just copy "C:\Windows\System32" this to PATH environment variable and close the current active command prompt and open try once.(If not working still try to reboot and check)

Error: cmd: Command failed with exit code ENOENT.

Upvotes: 0

MD Sazid Hasan Dip
MD Sazid Hasan Dip

Reputation: 1503

If you are in Windows usually this kind of error happens when you don't have all the paths required in your system environment path variable . Especially the path variables given bellow.

Please paste this line on your system environment Path variable:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Windows\System32;

You can also check this out. There is the total installation tutorial.

Upvotes: 4

Stackhelper
Stackhelper

Reputation: 63

Have you setup your android studio with right version of adt tools downloaded?

Upvotes: -1

Related Questions