Question

Days ago I built the application for Android, zero problems, but now, when I try to do the same for iOS (obviously not the same commands) I always receive an error.

I use the following command:

cordova platform add ios

And I get the following error:

Downloading cordova library for ios...
Download complete
Creating ios project...
Error: An error occured during creation of ios sub-project. 
  File "/Users/xxxxx/.cordova/lib/ios/cordova/3.3.0/bin/update_cordova_subproject", line 31
     print __doc__
                 ^
SyntaxError: invalid syntax

at /usr/local/lib/node_modules/cordova/src/platform.js:282:30
at ChildProcess.exithandler (child_process.js:641:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)

I tried also with:

phonegap build ios

But I get the same error and I don't know how to fix it. I've been looking on the Internet and I found some guy with the same problem but nobody could help him.

I run the commands with sudo, that isn't the problem.

Was it helpful?

Solution

I recently got the same error.

My problem was that I'm using Python3 by default. print in Python2 is a statement wherease in Python3 it's a function.

.cordova/lib/ios/cordova/3.3.0/bin/update_cordova_subproject has a shebang that calls /bin/python.

I had to replace #!/bin/python with #!/bin/python2.7 to use python2.7 on this script.

OTHER TIPS

I have the exactly same problem with you. However, the way replace "#!/bin/python with #!/bin/python2.7" doesn't work for me.

Inspired by the explanation of Matthieu Riegler, I change print __doc__ to print(__doc__) in line 31 and print line to print(line) in line 97. Eventually, it works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top