构建 Ionic 3 应用时出现错误。

12

我刚刚升级到了Mac Mojave(我确定这是问题的原因)。

问题是,每次我尝试使用命令构建我的应用程序时都会出现问题。

ionic cordova build ios

我遇到了以下错误。

CordovaError: Promise rejected with non-error: 'ios-deploy was not found. Please download, build and install version 1.9.2 or greater from https://github.com/phonegap/ios-deploy into your path, or do \'npm install -g ios-deploy\''
at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:30:15)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)

输入代码这里[错误]在运行cordova的子进程时发生了一个错误。

    cordova build ios exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

我想我需要安装ios-deploy,所以我运行了这个命令。

npm install -g ios-deploy

但是我遇到了以下错误。

npm ERR! code ELIFECYCLE
npm ERR! errno 65
npm ERR! ios-deploy@1.9.3 preinstall: `./src/scripts/check_reqs.js && xcodebuild`
npm ERR! Exit status 65
npm ERR! 
npm ERR! Failed at the ios-deploy@1.9.3 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alex/.npm/_logs/2018-10-15T15_07_47_819Z-debug.log

我已经到处寻找答案,但是找不到。

3个回答

29

在Ionic论坛中,似乎有一个关于此问题或非常相似的主题线:

Ionic论坛链接

简单总结一下,可能是XCode或某些依赖项没有在预期位置。

您可以尝试以下操作(如果由于权限原因失败,请添加sudo):

npm install -g ios-deploy --unsafe-perm=true


谢谢!它对我有用!另外,“ionic论坛链接”是失效的! - wilfredonoyola

13

我之前也遇到了这个问题。解决方法就是将iPhone从USB端口上拔下来。

  1. 拔掉所有连接在USB上的iOS设备
  2. 构建你的应用并等待完成
  3. 重新连接设备

0
修复方法如下: sudo npm install --global --unsafe-perm ios-deploy
希望能对某些人有所帮助。 感谢我之后再说吧。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接