`ionic cordova run ios --emulator`失败,并显示`运行子进程native-run时出错`

jexiocij  于 2023-09-28  发布在  Ionic
关注(0)|答案(1)|浏览(141)

我有一个Ionic Cordova应用程序,我一直在工作。最近我升级了cordova工具链,现在当我试图在ios模拟器上运行应用程序时,在构建成功后,它导致了native-run中的错误。
ionic cordova run ios --emulator的详细日志如下所示:

...<build logs trimmed>...

.
.
.
Touch /Volumes/Data/ionicprojects/MyApp/platforms/ios/build/Debug-iphonesimulator/MyApp.app (in target 'MyApp' from project 'MyApp')
    cd /Volumes/Data/ionicprojects/MyApp/platforms/ios
    /usr/bin/touch -c /Volumes/Data/ionicprojects/MyApp/platforms/ios/build/Debug-iphonesimulator/MyApp.app

** BUILD SUCCEEDED **

No scripts found for hook "after_compile".
No scripts found for hook "after_build".
> native-run ios --app "platforms/ios/build/emulator/MyApp.app" --virtual --verbose
[native-run] 2023-09-25T04:38:49.424Z native-run Caught fatal error: IOSRunException [Error]: Path 'platforms/ios/build/emulator/MyApp.app' not found
[native-run]     at Object.run (/Volumes/Data/ionicprojects/MyApp/node_modules/native-run/dist/ios/run.js:83:15)
[native-run]     at Object.run (/Volumes/Data/ionicprojects/MyApp/node_modules/native-run/dist/ios/index.js:15:15)
[native-run]     at async Object.run (/Volumes/Data/ionicprojects/MyApp/node_modules/native-run/dist/index.js:24:13) {
[native-run]   code: undefined,
[native-run]   exitCode: 1,
[native-run]   data: undefined
[native-run] }
[native-run] ERR_UNKNOWN: Path 'platforms/ios/build/emulator/MyApp.app' not found
[ERROR] An error occurred while running subprocess native-run.
        
        native-run ios --app "platforms/ios/build/emulator/MyApp.a... exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.
  ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
  ionic:utils-process onBeforeExit handler: running 5 functions +0ms
  ionic:lib:hooks Looking for ionic:serve:after npm script. +2m
  ionic:utils-process processExit: exiting (exit code: 1) +73ms

请注意,此时运行native-run ios --app "platforms/ios/build/emulator/MyApp.app" --virtual --verbose可以将应用程序成功部署到模拟器上。
通过查看cordova-ios更改日志,似乎默认的CONFIGURATION_BUILD_BLOCK覆盖已被删除,但我 * 无法 * 弄清楚如何从此回归或任何其他可能影响我的破坏性更改中迁移。

eoxn13cs

eoxn13cs1#

这是因为cordova-ios7更改-> https://cordova.apache.org/announcements/2023/07/10/cordova-ios-7.0.0.html

build/emulator will become build/Debug-iphonesimulator
build/device will become build/Release-iphoneos

要修复自cordova修复脚本以来的问题,请从您的ionic项目路径:

cd platforms/ios/build
ln -s Debug-iphonesimulator emulator

相关问题