NativeScript / nativescript-cli

Command-line interface for building NativeScript apps
https://www.npmjs.com/package/nativescript
Apache License 2.0
1.04k stars 195 forks source link

IOS build error -> Command xcrun with arguments simctl install code 204 - NSMachErrorDomain, code=-308 #5512

Closed lostation closed 3 years ago

lostation commented 3 years ago

Environment

✔ Your ANDROID_HOME environment variable is set and points to correct directory. ✔ Your adb from the Android SDK is correctly installed. ✔ The Android SDK is installed. ✔ A compatible Android SDK for compilation is found. ✔ Javac is installed and is configured properly. ✔ The Java Development Kit (JDK) is installed and is configured properly. ✔ Xcode is installed and is configured properly. ✔ xcodeproj is installed and is configured properly. ✔ CocoaPods are installed. ✔ CocoaPods update is not required. ✔ CocoaPods are configured properly. ✔ Your current CocoaPods version is newer than 1.0.0. ✔ Python installed and configured correctly. ✔ The Python 'six' package is found. ✔ Xcode version 11.6.0 satisfies minimum required version 10. ✔ Getting NativeScript components versions information... ⚠ Update available for component nativescript. Your current version is 6.8.0 and the latest available version is 7.2.0. ⚠ Update available for component tns-core-modules. Your current version is 6.5.18 and the latest available version is 6.5.25. ✔ Component tns-android has 6.5.3 version and is up to date. ⚠ Update available for component tns-ios. Your current version is 6.5.2 and the latest available version is 6.5.4.

"dependencies": { "@angular/animations": "^8.2.14", "@angular/cdk": "^8.2.3", "@angular/cli": "^8.3.28", "@angular/common": "^8.2.14", "@angular/compiler": "^8.2.14", "@angular/core": "^8.2.14", "@angular/forms": "^8.2.14", "@angular/material": "^8.2.3", "@angular/platform-browser": "^8.2.14", "@angular/platform-browser-dynamic": "^8.2.14", "@angular/platform-server": "^8.2.14", "@angular/router": "^8.2.14", "@google/markerclustererplus": "^2.1.11", "@google/markerwithlabel": "^1.2.12", "@nativescript/theme": "^2.2.1", "@nstudio/nativescript-loading-indicator": "^3.0.4", "@swimlane/ngx-charts": "^12.1.0", "@types/googlemaps": "^3.39.8", "@types/he": "^1.1.0", "@types/markerclustererplus": "^2.1.33", "acorn": "^6.4.0", "blob-polyfill": "^4.0.20190430", "bootstrap": "4.3.1", "chart.js": "^2.9.3", "chroma-js": "^2.1.0", "core-js": "3.2.1", "d3-ease": "^1.0.6", "decode-google-map-polyline": "^1.0.1", "file-saver": "^2.0.2", "font-awesome": "^4.7.0", "fullcalendar": "^3.10.1", "hammerjs": "^2.0.8", "he": "^1.2.0", "jquery": "^3.5.1", "jquery-ui": "^1.12.1", "js-sha1": "^0.6.0", "moment": "^2.24.0", "moment-timezone": "^0.5.26", "nativescript-angular": "8.21.0", "nativescript-dna-deviceinfo": "2.4.3", "nativescript-dom": "file:ns-libs/nativescript-dom", "nativescript-exit": "1.0.1", "nativescript-geolocation": "5.1.0", "nativescript-google-maps-sdk": "2.9.1", "nativescript-image-cache-it": "5.0.0-beta.15", "nativescript-iqkeyboardmanager": "1.5.1", "nativescript-material-button": "3.2.10", "nativescript-material-cardview": "3.2.10", "nativescript-material-ripple": "3.2.10", "nativescript-material-textfield": "3.2.10", "nativescript-menu": "1.1.6", "nativescript-plugin-firebase": "10.5.2", "nativescript-secure-storage": "2.6.0", "nativescript-sentry": "1.9.1", "nativescript-signalr": "file:ns-libs/nativescript-signalr", "nativescript-toasty": "3.0.0-alpha.2", "nativescript-ui-autocomplete": "6.0.1", "nativescript-ui-calendar": "6.1.0", "nativescript-ui-chart": "7.1.1", "nativescript-ui-date-range": "2.0.2", "nativescript-ui-gauge": "6.0.0", "nativescript-ui-highcharts": "1.2.1", "nativescript-ui-listview": "8.2.0", "nativescript-ui-sidedrawer": "8.0.1", "nativescript-websockets": "file:ns-libs/nativescript-websockets", "ng2-charts": "2.3.0", "ngx-bootstrap": "5.2.0", "ngx-gauge": "1.0.0-beta.12", "ngx-markdown": "8.1.0", "ngx-material-timepicker": "^5.5.3", "openlayers": "4.6.5", "plotly.js": "1.52.2", "popper.js": "^1.15.0", "primeicons": "^2.0.0", "primeng": "^8.0.3", "quill": "^1.3.7", "reflect-metadata": "0.1.13", "rxjs": "6.5.3", "signalr": "^2.4.1", "tether": "1.4.7", "tns-core-modules": "6.5.18", "tslib": "1.10.0", "uglify-js": "3.6.0", "web-animations-js": "^2.3.2", "xlsx": "^0.16.7", "zone.js": "^0.9.1" }, "devDependencies": { "@angular-devkit/build-angular": "^0.803.28", "@angular-devkit/schematics": "^8.3.28", "@angular/compiler-cli": "~8.2.14", "@nativescript/schematics": "1.0.0", "@nativescript/tslint-rules": "~0.0.5", "@swimlane/ngx-ui": "^27.0.0", "@swimlane/prettier-config-swimlane": "^2.0.0", "@types/chroma-js": "^2.0.0", "@types/d3-array": "^2.0.0", "@types/d3-brush": "^1.0.10", "@types/d3-color": "^1.2.2", "@types/d3-ease": "^1.0.9", "@types/d3-force": "^1.2.1", "@types/d3-format": "^1.3.1", "@types/d3-hierarchy": "^1.1.6", "@types/d3-interpolate": "^1.3.1", "@types/d3-scale": "^2.1.1", "@types/d3-selection": "^1.4.1", "@types/d3-shape": "^1.3.1", "@types/d3-time": "^1.0.10", "@types/d3-time-format": "^2.1.1", "@types/d3-transition": "^1.1.5", "@types/file-saver": "^2.0.1", "@types/jquery": "^3.5.5", "@types/node": "12.7.5", "@types/openlayers": "^4.6.17", "@types/plotly.js": "1.44.10", "@types/signalr": "^2.2.36", "@types/stripe-v3": "^3.1.22", "ajv": "^6.10.2", "codelyzer": "5.1.0", "nativescript-dev-webpack": "1.5.1", "nativescript-worker-loader": "0.12.1", "node-sass": "^4.13.0", "tns-android": "6.5.3", "tns-ios": "6.5.2", "tns-platform-declarations": "6.5.15", "ts-loader": "^5.3.0", "ts-node": "8.3.0", "tslint": "5.20.0", "typescript": "3.5.3", "typings": "2.1.1" }

Describe the bug

It's a build time error but it seems the project build is fine. It seems coming from the hooks script Xcode command to push to emulator that didn't work anymore...

Command done to build: tns run ios --no-hmr --env.verbose --env.sourceMap --env.configuration='test' --env.target='*****' --log trace > logTrace.txt

I already tried to restart from scratch clean node_modules, hooks, config, re-install...tns remove|add platform ios

Info: I cannot update right now to NS7 and try Xcode 12 and so on... I really don't know why it not work anymore...The last build and release I've done with the same version and codebase was on last October...and it worked well.

I've also tried different Xcode version, 11.7, 11.6 still the same issue, re-install command line tools... I've also tried opening Xcode project and build from there... same issue

The operation couldn’t be completed. (Mach error -308 - (ipc/mig) server died) Domain: NSMachErrorDomain Code: -308

I'm stucked at that point, the project build but not able to test it... And I don't know what to do more for that.

Please if someone has already catch this kind of error...thanks in advance.

To Reproduce Don't know as this problem wasn't there some months ago...

Expected behavior Push the builded code to the device or emulator

Log Trace

---> BUILD SUCCEEDED

Project dir from hooksArgs is: /Portal. Hooks directories: [ '/Portal/hooks' ] AfterHookName for command buildIOS is after-buildIOS Project successfully built. The build result is located at: /Portal/platforms/ios/build/Debug-iphonesimulator/Portal.app Installing on device EB9898E5-A1F9-4FD3-9A09-0537C48A5A06... Project dir from hooksArgs is: undefined. Hooks directories: [ '/Portal/hooks' ] BeforeHookName for command install is before-install Unable to apply changes on device: EB9898E5-A1F9-4FD3-9A09-0537C48A5A06.

Error is: Command xcrun with arguments simctl install EB9898E5-A1F9-4FD3-9A09-0537C48A5A06 /Portal/platforms/ios/build/Debug-iphonesimulator/Portal.app failed with exit code 204.

Error output: An error was encountered processing the command (domain=NSMachErrorDomain, code=-308): The operation couldn’t be completed. (Mach error -308 - (ipc/mig) server died) . Will emit event runOnDeviceError with data { projectDir: '/Portal', deviceIdentifier: 'EB9898E5-A1F9-4FD3-9A09-0537C48A5A06', applicationIdentifier: 'com.**.app', error: Error: Command xcrun with arguments simctl install EB9898E5-A1F9-4FD3-9A09-0537C48A5A06 /Portal/platforms/ios/build/Debug-iphonesimulator/Portal.app failed with exit code 204. Error output: An error was encountered processing the command (domain=NSMachErrorDomain, code=-308): The operation couldn’t be completed. (Mach error -308 - (ipc/mig) server died)

  at ChildProcess.<anonymous> (/usr/local/lib/node_modules/nativescript/node_modules/ios-sim-portable/lib/child-process.js:56:28)
  at ChildProcess.emit (events.js:315:20)
  at maybeClose (internal/child_process.js:1048:16)
  at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)

} Stopping webpack watch for platform ios. Project dir from hooksArgs is: Portal Hooks directories: [ '/Portal/hooks' ] AfterHookName for command watch is after-watch Will emit event runOnDeviceStopped with data { projectDir: '/Portal', deviceIdentifier: 'EB9898E5-A1F9-4FD3-9A09-0537C48A5A06' } Webpack process exited with code null when we expected it to be long living with watch.

tns device = │ iPad Air (3rd generation) │ iOS │ EB9898E5-A1F9-4FD3-9A09-0537C48A5A06 │ Emulator │ Connected │ Local

I've also tried a full computer reinstall with Catalina 10.15.7 and Xcode 11.5 ... but same build error ...

Please hints ... Thanks.

lostation commented 3 years ago

Ok solved ! --> Error was located in Info.plist from App_Resources.

<key>CFBundleVersion</key>
<**integer**>3001006</**integer**>     Should be string and not integer -->  <**string**>3001006</**string**>

Stupid things...as always... I've added nativescript-set-version and customize a bit the code to my needs BUT... I was returning and integer instead of a string while computing version string...