1

I am doing a ionic 6 project having node -v v16.13.1 and npm -v 8.1.2 I did "npm install" and after that when i run "ionic cordova platform add android" i get the below error. I am using Ubuntu Terminal. this happens only if i use node above v10.17.0. Please let me know how to fix this.

**Error: spawn ENOTDIR**

at ChildProcess.spawn (node:internal/child_process:412:11)
at Object.spawn (node:child_process:698:9)
at spawn
(/usr/local/lib/node_modules/ionic/node_modules/cross-spawn/index.js:12:24)
at spawn
(/usr/local/lib/node_modules/ionic/node_modules/@ionic/utils-subprocess/dist/index.js:169:12)
at Subprocess.spawn
(/usr/local/lib/node_modules/ionic/node_modules/@ionic/utils-subprocess/dist/index.js:142:16)
at Subprocess.run
(/usr/local/lib/node_modules/ionic/node_modules/@ionic/utils-subprocess/dist/index.js:104:24)
at Shell.run (/usr/local/lib/node_modules/ionic/lib/shell.js:31:34)
at async PlatformCommand.runCordova
(/usr/local/lib/node_modules/ionic/commands/cordova/base.js:122:13)
at async PlatformCommand.run
(/usr/local/lib/node_modules/ionic/commands/cordova/platform.js:77:9)
at async Promise.all (index 0)

Output of my "ionic info" command:

Ionic:

Ionic CLI : 5.4.10 (/usr/local/lib/node_modules/ionic) Ionic Framework : @ionic/angular 6.1.11 @angular-devkit/build-angular : 13.2.6 @angular-devkit/schematics : 13.2.6 @angular/cli : 13.2.6 @ionic/angular-toolkit : 6.1.0

Capacitor:

Capacitor CLI : 3.5.1 @capacitor/core : 3.5.1

Cordova:

Cordova CLI : not installed Cordova Platforms : not available Cordova Plugins : not available

Utility:

cordova-res : not installed native-run : 1.6.0

System:

Android SDK Tools : 26.1.1 (/home/etpl41/Android/Sdk) NodeJS : v16.13.1 (/home/etpl41/.nvm/versions/node/v16.13.1/bin/node) npm : 8.1.2 OS : Linux 4.4

Regards, Rupak

Team FOS
  • 11
  • 2
  • If it happens only for certain versions as you mentioned, I guess something's up with the compatibility of the frameworks. Try referring the Ionic documentation to check what versions of Node are supported. – Debargha Roy Jun 24 '22 at 08:08
  • You're trying to use the cordova cli to add Android, but you don't have it installed. You do have Capacitor installed though. If this is a new project, try `npx cap add android`. – alex87 Jun 27 '22 at 04:51

0 Answers0