Cordoba throws a syntax error when trying to add a platform

I am trying to install Cordova and Ionic Framework on an Ubuntu server. I already used Node.js on it, so I just ran:

sudo npm install -g cordova

Then I cloned a sample project from GitHub

sudo git clone https://github.com/driftyco/ionic-weather.git

I went into the directory and tried to add the iOS platform library to create it:

cd ionic-weather
sudo cordova platform add ios

However, it produces the following error:

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)

I tried reinstalling Cordoba if something went bad but no luck. It seems I cannot find anyone else with this problem, so I am stuck. Any ideas?

+4
source share
2 answers

This turned out to be a combination of several problems:

  • Ant - , , , . , SO .
  • JDK. ( JRE)
  • 2 ( Android ).

Ant

sudo apt-get install ant.

JDK

sudo update-alternatives --config java

, jdk, `sudo update-alternatives -get-selections | grep ^ java

jdk, jre jdk, sudo update-alternatives --config java

, jdk ( jre), sudo apt-get install openjdk-7-jdk

~/.bashrc

$ cd ~
$ sudo vi .bashrc

, PATH= platform-tools tools sdk. platform-tools.

, ios Windows, , , Linux. , . , ios Linux, OSx.

ios xcode 4.5 , OSx 10.7, ios Windows Linux. , cordova ionic , , , Linux , , Linux, Windows, Linux.

+5
+5

Source: https://habr.com/ru/post/1529656/


All Articles