我正在使用我的 Mac Pro 设置开发平台。我已经安装了 GIT、NODEJS、PhoneGap 和 Cordova。我已成功将存储库克隆到我的计算机并添加了 IOS 平台。但是当我去构建我的项目时,我收到一个错误:
命令失败,退出代码为 2。
我还需要安装其他东西吗?
这是我的错误:
bash-3.2# sudo -s bash-3.2# phonegap build ios [phonegap] executing 'cordova build ios'... Running command: /Users/developer/PhoneBook/DOR_Phonebook_mobile/DorPhonebook/platforms/ios/cordova/build
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
ERROR building one of the platforms: Error: /Users/developer/PhoneBook/DOR_Phonebook_mobile/DorPhonebook/platforms/ios/cordova/build: Command failed with exit code 2 You may not have the required environment or OS to build this project
Error: /Users/developer/PhoneBook/DOR_Phonebook_mobile/DorPhonebook/platforms/ios/cordova/build: Command failed with exit code 2 at ChildProcess.whenDone (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23) at ChildProcess.emit (events.js:110:17) at maybeClose (child_process.js:1015:16) at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
最佳答案
首先,您不需要 Cordova 和 PhoneGap,因为您只需使用另一个名称安装相同的东西即可。
选择听起来更适合您的名称后,您应该解决您的 XCode 问题。 Stackoverflow 上已经有一个问题 -> Unable to use xcode-commandlinetools .
正如我在那里看到的,我首先建议您检查是否安装了最新版本的 xcode 和 node。如果您已经有最新版本,请尝试重新安装 Xcode 或尝试运行
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
按照我所说的完成所有操作后,尝试再次创建一个项目。
关于ios - 在 Mac Pro 上使用 PhoneGap 的开发平台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31706996/