Skip to content

Cannot destructure property 'version' of 'this.$projectDataService.getRuntimePackage(...)' as it is undefined. #5391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
karauda opened this issue Sep 20, 2020 · 23 comments · Fixed by #5406
Assignees
Labels

Comments

@karauda
Copy link

karauda commented Sep 20, 2020

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):

  • CLI: 7.0.8
  • Cross-platform modules: "@nativescript/angular": "10.0.0"
  • Android Runtime: -
  • iOS Runtime: "@nativescript/ios": "7.0.0"
  • Plugin(s): nativescript-ui-listview, nativescript-ui-sidedrawer

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

@rigor789
Copy link
Member

@karauda I believe I know where this is coming from - can you try setting markingMode to none?

I believe it fails here:

const { version } = this.$projectDataService.getRuntimePackage(
this.$projectHelper.projectDir,
PlatformTypes.android
);

Will be fixing it in a CLI release.

@rigor789 rigor789 transferred this issue from NativeScript/NativeScript Sep 20, 2020
@rigor789 rigor789 added the bug label Sep 20, 2020
@rigor789 rigor789 self-assigned this Sep 20, 2020
@karauda
Copy link
Author

karauda commented Sep 20, 2020

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

@karauda
Copy link
Author

karauda commented Sep 20, 2020

One more important comment - when I have multiple devices/emulators connected, I see the same error - but multiple times.

@rigor789
Copy link
Member

What's in your package.json?

@karauda
Copy link
Author

karauda commented Sep 20, 2020

 "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"
  },

@karauda
Copy link
Author

karauda commented Sep 20, 2020

Also, app builded without --release is working ultra fine, builded with --release is always crashing after splash.

@jwrascoe
Copy link

@rigor789 I am also having the same issue, is there any work-around other than to build without --release?

@BlueHunter99
Copy link

@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.

@farfromrefug
Copy link
Contributor

farfromrefug commented Sep 24, 2020

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


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

} else if (platform === constants.PlatformTypes.android) {

@rigor789 i fixed it locally by using toLowerCase but the question is more why does it comes as title case?

@BlueHunter99
Copy link

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.

@NathanaelA

This comment was marked as abuse.

@farfromrefug
Copy link
Contributor

@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

@BlueHunter99
Copy link

@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!

@NathanaelA

This comment was marked as abuse.

@jwrascoe
Copy link

@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

@farfromrefug
Copy link
Contributor

@jwrascoe i did production releases for iOS and Android using the changes above plus the ones here NativeScript/NativeScript#8875 (comment) for snapshot android builds.
I am using svelte and Vue but i dont think angular should make a difference.

@BlueHunter99
Copy link

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

@jwrascoe
Copy link

jwrascoe commented Oct 1, 2020

@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

@BlueHunter99
Copy link

@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.

@mreall
Copy link

mreall commented Oct 2, 2020

@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.

@mreall
Copy link

mreall commented Oct 2, 2020

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

@jwrascoe
Copy link

jwrascoe commented Oct 2, 2020

@BlueHunter99 we released to production today for both Android & iOS... no crashes.. all seems normal.

@jwrascoe
Copy link

jwrascoe commented Oct 2, 2020

@mreall use find on the command line...
sudo find / -name project-data-service.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants