Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
xCode12 / NS7 / Angular10
Describe the bug
App after upgrade NativeScript to v7 and Angular to v10, works perfect when building in debug mode - on emulator and on real iOS device. But when pushing app to TestFlight it is Crashing just after run. So I tried to run on emulator in release mode:
tns run ios --release --clean --emulator
And just after searching for devices I see an error:
Cannot destructure property 'version' of 'this.$projectDataService.getRuntimePackage(...)' as it is undefined.
tns run ios (without release parameter) works, app builded and working well on emulator.
To Reproduce
tns run ios --release --clean --emulator
Expected behavior
expected to work in release mode and on test flight
@karauda I believe I know where this is coming from - can you try setting markingMode to none?
I believe it fails here: https://github.com/NativeScript/nativescript-cli/blob/dd095473daca8436979e8dd95d87f69c1fbf5f9c/lib/services/marking-mode-service.ts#L44-L47
Will be fixing it in a CLI release.
Still the same:
✗ tns run ios --release --emulator
Searching for devices...
Cannot destructure property 'version' of 'this.$projectDataService.getRuntimePackage(...)' as it is undefined.
My nativescript.config.ts:
import { NativeScriptConfig } from '@nativescript/core'
export default {
id: 'com.xxxx',
appResourcesPath: 'App_Resources',
android: {
v8Flags: '--expose_gc',
markingMode: 'none',
},
appPath: 'src',
ios: {
id: 'com.xxxx',
markingMode: 'none',
},
} as NativeScriptConfig
One more important comment - when I have multiple devices/emulators connected, I see the same error - but multiple times.
What's in your package.json?
"dependencies": {
"@angular/animations": "~10.1.0",
"@angular/common": "~10.1.0",
"@angular/compiler": "~10.1.0",
"@angular/core": "~10.1.0",
"@angular/forms": "~10.1.0",
"@angular/platform-browser": "~10.1.0",
"@angular/platform-browser-dynamic": "~10.1.0",
"@angular/router": "~10.1.0",
"@nativescript/angular": "10.0.0",
"@nativescript/core": "~7.0.0",
"@nativescript/theme": "~2.5.0",
"apollo-angular": "^1.10.0",
"apollo-angular-link-http": "^1.11.0",
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",
"apollo-link": "^1.2.14",
"core-js": "^3.6.0",
"graphql": "^15.1.0",
"graphql-tag": "^2.10.4",
"nativescript-ui-listview": "^9.0.2",
"nativescript-ui-sidedrawer": "^9.0.3",
"reflect-metadata": "~0.1.12",
"rxjs": "~6.6.0",
"tslib": "1.10.0",
"zone.js": "^0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1001.0",
"@angular/cli": "~10.1.0",
"@angular/compiler-cli": "~10.1.0",
"@nativescript/android": "7.0.0",
"@nativescript/ios": "7.0.0",
"@nativescript/tslint-rules": "~0.0.5",
"@nativescript/webpack": "~3.0.0",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"node-sass": "^4.7.1",
"protractor": "^7.0.0",
"ts-node": "~8.3.0",
"tslint": "^5.20.1",
"typescript": "~3.9.0"
},
Also, app builded without --release is working ultra fine, builded with --release is always crashing after splash.
@rigor789 I am also having the same issue, is there any work-around other than to build without --release?
@rigor789 I seem to have a similar issue, but my error is Cannot destructure property 'version' of 'undefined' or 'null'.. It shows upon running tns run with the previous line being Platform android/ios succesfully added. v7.0.0
I can confirm this happens _only_ when the --release tag is present.
It is a problem on both Android and iOS in my case.
just got the same issue here. Here is the full error stack
Executing before-prepare hook at location /Volumes/dev/nativescript/ns-forecastie/hooks/before-prepare/nativescript-community-ui-material-core.js in-process
Validating before-prepare arguments.
Could not find an installed runtime, falling back to default runtimes
Error while executing action on device 3300f8ed286f148f. The error is TypeError: Cannot destructure property `version` of 'undefined' or 'null'.
at PrepareController.<anonymous> (/usr/local/pnpm-global/4/node_modules/.pnpm/[email protected]/node_modules/nativescript/lib/controllers/prepare-controller.js:283:19)
at Generator.next (<anonymous>)
at /usr/local/pnpm-global/4/node_modules/.pnpm/[email protected]/node_modules/nativescript/lib/controllers/prepare-controller.js:14:71
at new Promise (<anonymous>)
at __awaiter (/usr/local/pnpm-global/4/node_modules/.pnpm/[email protected]/node_modules/nativescript/lib/controllers/prepare-controller.js:10:12)
at PrepareController.trackRuntimeVersion (/usr/local/pnpm-global/4/node_modules/.pnpm/[email protected]/node_modules/nativescript/lib/controllers/prepare-controller.js:282:16)
at PrepareController.descriptor.<computed> (/usr/local/pnpm-global/4/node_modules/.pnpm/[email protected]/node_modules/nativescript/lib/common/decorators.js:24:40)
at PrepareController.<anonymous> (/usr/local/pnpm-global/4/node_modules/.pnpm/[email protected]/node_modules/nativescript/lib/controllers/prepare-controller.js:86:24)
at Generator.next (<anonymous>)
at fulfilled (/usr/local/pnpm-global/4/node_modules/.pnpm/[email protected]/node_modules/nativescript/lib/controllers/prepare-controller.js:11:58) {
deviceIdentifier: '3300f8ed286f148f'
}
The issue is here https://github.com/NativeScript/nativescript-cli/blob/686135ca8a11ad224873864a2c0c254f79c4b8ce/lib/services/project-data-service.ts#L640
For some reason the cli does not find the runtime devDep even though it is here.
EDIT: found the issue platform is Android instead of android thus we dont go there https://github.com/NativeScript/nativescript-cli/blob/686135ca8a11ad224873864a2c0c254f79c4b8ce/lib/services/project-data-service.ts#L609
@rigor789 i fixed it locally by using toLowerCase but the question is more why does it comes as title case?
Did anyone find a workaround for this? Perhaps a different version or something like that. I have updated our entire app to NS7 and Angular 10, because NS6 wasn't playing nicely with iOS14 anymore for me. This seems like a pretty serious issue thats affecting multiple people but it doesn't seem to have much priority.
@BlueHunter99 - For NS 6.x, you can use the iOS 6.5.2 engine for IOS 14, we fixed that about a month ago...
As for the NS 7 cli, this is not the only issue that has occurred, iOS 14, and XCode 12 actually broke several more items when they were released...
@BlueHunter99 right now you can edit nativescript/cliservices/project-data-service.js . You need to find where it is installed on your computer.
Open it then look for getInstalledRuntimePackage function.
add this line at the begining of the method:
platform = platform.toLowerCase();
It should work now
@NathanaelA Sorry for my passive agressiveness, tough morning.
I did use the 6.5.2 engine, which stopped the app from crashing on startup. I ran into other issues after that, which would freeze the app and half-crash the iOS keyboard UI. I spent a solid day debugging it but would get no errors whatsoever.
Decided to try to fix it by updating to NS7, and it is just very frustrating when the app works perfectly now but I'm unable to release it to my users.
@farfromrefug thanks, I'll try it out!
@BlueHunter99 - I have had many days like that. No worries... :grinning: As an aside I use iDeviceSysLog to get sometimes the logs that sometimes NativeScript doesn't show you properly. If the app crashes during startup; I have seen frequently where NS doesn't log the error; which is very annoying (imho) so idevcesyslog is invaluable for those cases.
I also just wanted to let you know you could use NS 6 w/ 6.5.2 and it should work the same. To our knowledge their weren't any other breaking changes in iOS 14 that breaks the 6.5.2 engine. We do want people to be able to use both NS 6 until they feel comfortable moving to 7. However, your report is the second mention I have seen of freezes on iOS --- so their might be something, I certain hope not.... :grinning:
@BlueHunter99 we too have been trying to go production with NS7 & Angular 10, working thur the issues... mainly syntax changes and package issues... but the --release was a deal breaker for us... so we backed back down to NS6 & Angular 8.
I totally get your frustration as we have been switching back and fourth for the last 10 days...
We are going to try the patch from @farfromrefug later to day and will let you know if we have any of the freezing issues when we build the --release code.... running it just as ns run ios/android was fine but need to test hard on the --release
@jwrascoe i did production releases for iOS and Android using the changes above plus the ones here https://github.com/NativeScript/NativeScript/issues/8875#issuecomment-698308608 for snapshot android builds.
I am using svelte and Vue but i dont think angular should make a difference.
We do want people to be able to use both NS 6 until they feel comfortable moving to 7. However, your report is the second mention I have seen of freezes on iOS --- so their might be something, I certain hope not.... 😀
@NathanaelA turns out the freezes were most likely caused by the AutoFitText plugin, because they still very rarely occurred in my NS7 version. Replacing all AutoFitText elements with normal Label elements has solved the crashing for me. I guess it's a nice thing that our app is now updated for the NS7 future already.
Will be reporting the bug of AutoFitText when I find some time. So far the only logs I've gotten out of it are from XCode:
HandleScope::HandleScope
Entering the V8 API without proper locking in place
@BlueHunter99 I finally had the time last night to switch our app back over... All built fine however I used [email protected] for the CLI and @nativescript/[email protected] (just released last night)
The patch from @farfromrefug for the CLI is still required to build --release
All appears to be working, however I dont use the AutoFitText (but will try)
I will publish later today into each app store and see if there is any drama
@jwrascoe our app is waiting for review as we speak. Using the latest versions of the CLI and core with the manual patch from @farfromrefug.
@BlueHunter99 right now you can edit
nativescript/cliservices/project-data-service.js. You need to find where it is installed on your computer.
@farfromrefug thanks for the tip. Where did you find nativescript/cliservices/project-data-service.js? I can't find it on my mac.
I finally found it and was able to build my project. It was located here:
/usr/local/lib/node_modules/nativescript/lib/services/project-data-service.js
@BlueHunter99 we released to production today for both Android & iOS... no crashes.. all seems normal.
@mreall use find on the command line...
sudo find / -name project-data-service.js
Most helpful comment
@BlueHunter99 right now you can edit
nativescript/cliservices/project-data-service.js. You need to find where it is installed on your computer.Open it then look for
getInstalledRuntimePackagefunction.add this line at the begining of the method:
It should work now