是否安裝了所有其他依賴項?除了
npm install -g cordova
你還需要安裝平臺的SDK爲您構建的每個平臺,您可能需要安裝Java以及取決於你是否正在構建Android和已經存在於您的機器上有什麼。您需要Xcode(並使用Mac)才能爲iOS構建。
關於安裝過程的正式科爾多瓦文檔是here。我會強烈建議不要用科爾多瓦5打算,除非你有,而是採用了最新的6.1.1科爾多瓦,您可以用得到:
npm install -g [email protected]
然後驗證它:
cordova --version
應該返回6.1。 1在寫作時。
然後嘗試:
cordova create hello com.example.hello HelloWorld
cd hello
cordova platform add ios android
cordova requirements
最後一個命令「科爾多瓦要求」應該告訴你,如果安裝了一切,科爾多瓦的需要。例如在我的系統上:
cordova requirements
Requirements check results for android:
Java JDK: installed .
Android SDK: installed
Android target: installed android-17,android-18,android-19,android-20,android-21,android-22,android-23,Google Inc.:Google APIs:17,Google Inc.:Google APIs:18,Google Inc.:Glass Development Kit Preview:19,Google Inc.:Google APIs:19,Google Inc.:Google APIs (x86 System Image):19,Google Inc.:Google APIs:21,Google Inc.:Google APIs:22,Google Inc.:Google APIs:23
Gradle: installed
Requirements check results for ios:
Apple OS X: installed darwin
Xcode: installed 7.2
ios-deploy: not installed
ios-deploy was not found. Please download, build and install version 1.8.3 or greater from https://github.com/phonegap/ios-deploy into your path, or do 'npm install -g ios-deploy'