Apache Cordova throws syntax error when adding platform
Not sure about the ios error (is that supported on linux? - it's not in the list of available platforms when you do a "cordova platform list"). Probably needs additional installation and an Apple dev certificate.
As for the Android error - you should be able to fix that:
Check your ant install is responding to "ant -version".
Have a look at this answer for setting up the required paths in Linux, and double check all your paths with a file explorer: https://stackoverflow.com/a/21142421
Make sure to logout/login to apply the paths.
Also check your path is what you think it is with a "echo $PATH".
Benedict Lewis
Updated on September 18, 2022Comments
-
Benedict Lewis over 1 year
I've been trying to get started with Ionic Framework, and one of the steps is installing Cordova.
sudo npm install -g cordova
Which works fine. Then I have to add both the iOS and Android platforms, but when trying to I get errors:
iOS:
benedict@prometheus:/var/www/ionic/hello$ sudo cordova platform add ios Creating ios project... /home/benedict/.cordova/lib/ios/cordova/3.4.0/bin/create: 33: /home/benedict/.cordova/lib/ios/cordova/3.4.0/bin/create: Syntax error: "(" unexpected Error: /home/benedict/.cordova/lib/ios/cordova/3.4.0/bin/create: Command failed with exit code 2 at ChildProcess.whenDone (/usr/lib/node_modules/cordova/src/superspawn.js:112:23) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:743:16) at Process.ChildProcess._handle.onexit (child_process.js:810:5)
Android:
benedict@prometheus:/var/www/ionic/hello$ sudo cordova platform add android Creating android project... /home/benedict/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:126 throw e; ^ Error: An error occurred while listing Android targets at /home/benedict/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:87:29 at _rejected (/home/benedict/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24) at /home/benedict/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30 at Promise.when (/home/benedict/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31) at Promise.promise.promiseDispatch (/home/benedict/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41) at /home/benedict/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44 at flush (/home/benedict/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17) at process._tickCallback (node.js:415:13) Error: /home/benedict/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8 at ChildProcess.whenDone (/usr/lib/node_modules/cordova/src/superspawn.js:112:23) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:743:16) at Process.ChildProcess._handle.onexit (child_process.js:810:5)
I have tried reinstalling Cordova, but to no avail. Any idea what the problem is?
-
Brian Vanderbusch about 10 yearssame exact errors for me.
-