如何从Ionic + iPhone的终端运行项目?

时间:2015-03-27 00:34:02

标签: ios cordova ionic-framework cordova-plugins ionic

MacBook-Pro:myApps naveenkumar$ ionic run  ios
Adding in default Ionic hooks
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/hooks/after_prepare/010_add_platform_class.js /Users/naveenkumar/Documents/ionic_work/myApps
add to body class: platform-ios
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/hooks/after_prepare/020_remove_sass_from_platforms.js /Users/naveenkumar/Documents/ionic_work/myApps
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/platforms/ios/cordova/run 
Cordova needs ios-sim version 3.0.0 or greater, you have version 1.9.0
.
ERROR running one or more of the platforms: Error: /Users/naveenkumar/Documents/ionic_work/myApps/platforms/ios/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
MacBook-Pro:myApps naveenkumar$ 

您好, 我正试图从终端运行我的项目。我收到了上述错误。但是当我从给定的iOS目录运行我的项目 Xcode 时,它运行正常。这意味着,当我从Xcode运行时,我能够运行模拟器/模拟器并检查我的输出。但是当我从终端运行时,我无法运行我的应用程序。你能告诉我如何从终端运行我的应用程序吗?

由于

3 个答案:

答案 0 :(得分:5)

这就是问题所在:

Cordova needs ios-sim version 3.0.0 or greater, you have version 1.9.0

以下是解决方案:

npm update -g ios-sim

答案 1 :(得分:1)

问题是您没有安装ios-sim。 从ionic framework website,您可以看到以下声明:

  

注意:iOS开发需要Mac OS X.通过Ionic CLI 的iOS模拟器需要ios-sim npm软件包,可以使用命令 sudo npm -g install ios-安装SIM

您只需运行此命令即可安装ios-sim:

  • sudo npm -g install ios-sim

答案 2 :(得分:0)

找不到simctl。 检查您是否安装了Xcode 7.x:     xcodebuild --version检查你选择了Xcode 7.x:     xcode-select --print-path