[英]Errors when trying to build iOS with cordova in Mavericks (10.9.1)
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. 几天前我为Android构建了应用程序,零问题,但现在,当我尝试为iOS做同样的事情(显然不是相同的命令)时,我总是收到一个错误。
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. 我用sudo运行命令,这不是问题。
I recently got the same error. 我最近得到了同样的错误。
My problem was that I'm using Python3 by default. 我的问题是我默认使用Python3。
print
in Python2 is a statement wherease in Python3 it's a function. 在Python2中
print
是Python3中的一个语句,它是一个函数。
.cordova/lib/ios/cordova/3.3.0/bin/update_cordova_subproject
has a shebang that calls /bin/python
. .cordova/lib/ios/cordova/3.3.0/bin/update_cordova_subproject
有一个调用/bin/python
的shebang。
I had to replace #!/bin/python
with #!/bin/python2.7
to use python2.7 on this script. 我不得不用
#!/bin/python2.7
替换#!/bin/python
来在这个脚本上使用python2.7。
I have the exactly same problem with you. 我和你有完全相同的问题。 However, the way replace "
#!/bin/python
with #!/bin/python2.7
" doesn't work for me. 但是,用
#!/bin/python2.7
替换“ #!/bin/python
”的方式对我来说不起作用。
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. 受Matthieu Riegler的解释启发,我在第31
print line
更改print __doc__
以print(__doc__)
并在第97 print line
更改print(line)
。最后,它可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.