Repository navigation
[TIP] [SOLVED] Nativescript Zip error on tns run ios and android #34
Description
Activity
- changed the title
[-]Nativescript Zip error on tns run ios[/-][+]Nativescript Zip error on tns run ios and android[/+]on Aug 8, 2019 Do you run this on a device as a standalone app? Which command to run the app?
I haven't gotten that far yet. I installed the plugin, followed the tutorial by placing the relevant appsync code in the main.ts. I also reinstalled the android & ios platforms as well as reinstalled the npm packages with
npm installand then by deleting the folders directly and reinstalling.I've tried running
tns run iosfrom a terminal and from Sidekick. This error also occurs withtns run android.I'm just running the app on a simulator at the moment.
Doing a little digging, Is there a webpack thing that needs to be done with {N} 6+?
Update: I had to installed Nativescript-Zip (from your package.json) and I got passed the webpack errors. I'm still receiving the stacktrace when the app loads:
Webpack compilation complete. Watching for file changes. Webpack build done! Project successfully prepared (ios) Installing on device D306173A-2805-42CB-88FF-6F2663C6DC40... Successfully installed on device with identifier 'D306173A-2805-42CB-88FF-6F2663C6DC40'. Successfully transferred all files on device D306173A-2805-42CB-88FF-6F2663C6DC40. Restarting application on device D306173A-2805-42CB-88FF-6F2663C6DC40... Successfully synced application com.nativescript.{appname} on device D306173A-2805-42CB-88FF-6F2663C6DC40. Preparing project... Project successfully prepared (ios) Installing on device 6A1095F3-58DF-4F18-9B22-C284166E3E55... ***** Fatal JavaScript exception - application has been terminated. ***** Native stack trace: 1 0x100b4391f NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool) 2 0x100b89d1f -[TNSRuntime executeModule:referredBy:] 3 0x100389be3 main 4 0x104a86541 start JavaScript stack trace: 1 ../node_modules/properties/lib/stringify.js@file:///node_modules/properties/lib/stringify.js:9:17 2 __webpack_require__@file:///app/webpack/bootstrap:750:0 3 fn@file:///app/webpack/bootstrap:120:0 4 ../node_modules/properties/lib/write.js@file:///node_modules/properties/lib/write.js:4:23 5 __webpack_require__@file:///app/webpack/bootstrap:750:0 6 fn@file:///app/webpack/bootstrap:120:0 7 ../node_modules/properties/lib/index.js@file:///node_modules/properties/lib/index.js:7:19 8 __webpack_require__@file:///app/webpack/bootstrap:750:0 9 fn@file:///app/webpack/bootstrap:120:0 10 @file:///node_modules/tns-core-modules/ui/core/bindable/bindable.js:2:27 11 ../node_modules/tns-core-modules/ui/core/bindable/bindable.js@file:///app/vendor.js:177029:34 12 __webpack_require__@file:///app/webpack/bootstrap:750:0 13 fn@file:///app/webpack/bootstrap:120:0 14 @file:///node_modules/tns-core-modules/ui/builder/component-builder/component-builder.js:2:25 15 ../node_modules/tns-core-modules/ui/builder/component-builder/component-builder.js@file:///app/vendor.js:176129:34 16 __webpack_require__@file:///app/webpack/bootstrap:750:0 17 fn@file:///app/webpack/bootstrap:120:0 18 @file:///node_modules/tns-core-modules/ui/builder/builder.js:5:34 <…> JavaScript error: file:///node_modules/properties/lib/stringify.js:9:17 JS ERROR TypeError: undefined is not an object (evaluating 'global.process.platform') (CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: TypeError: undefined is not an object (evaluating 'global.process.platform') at 1 ../node_modules/properties/lib/stringify.js@file:///node_modules/properties/lib/stringify.js:9:17 2 __webpack_require__@file:///app/webpack/bootstrap:750:0 3 fn@file:///app/webpack/bootstrap:120:0 4 ../node_modules/properties/lib/write.js@file:///node_modules/properties/lib/write.js:4:23 5 __webpack_require__@file:///app/webpack/bootstrap:750:0 6 fn@file:///app/webpack/bootstrap:120:0 7 ../node_modules/properties/lib/index.js@file:///node_modules/properties/lib/index.js:7:19 8 __webpack_require__@file:///app/webpack/bootstrap:750:0 9 fn@file:///app/webpack/bootstrap:120:0 10 @file:///node_modules/tns-core-modules/ui/core/bindable/bindable.js:2:27 11 ../node_modules/tns-core-modules/ui/core/bindable/bindable.js@file:///app/vendor.js:177029:34 12 __webpack_require__@file:///app/webpack/bootstrap:750:0 13 fn@file:///app/webpack/bootstrap:120:0 14 @file:///node_modules/tns-core-modules/ui/builder/component-builder/component-builder.js:2:25 15 ../node_modules/tns-core-modules/ui/builder/component-builder/component-bu<…> NativeScript caught signal 6. Native Stack: 1 0x100b8884f sig_handler(int) 2 0x104deab5d _sigtramp 3 0xffff00001fa5 4 0x104b6d01d abort 5 0x1049019d1 __cxa_bad_cast 6 0x104901b6f default_unexpected_handler() 7 0x103a73e2d _objc_terminate() 8 0x10490da2e std::__terminate(void (*)()) 9 0x10490d4eb __cxa_get_exception_ptr 10 0x10490d4b2 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*) 11 0x103a73bfa _objc_exception_destructor(void*) 12 0x100b43d58 NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool) 13 0x100b89d1f -[TNSRuntime executeModule:referredBy:] 14 0x100389be3 main 15 0x104a86541 start JS Stack:Just for info... here's my package.json:
{ "description": "{name}", "license": "SEE LICENSE IN <your-license-filename>", "readme": "NativeScript Application", "repository": "<fill-your-repository-here>", "nativescript": { "id": "{bundleid}", "tns-ios": { "version": "6.0.2" }, "tns-android": { "version": "6.0.1" } }, "dependencies": { "@angular/animations": "8.0.0", "@angular/cli": "^7.1.0", "@angular/common": "8.0.0", "@angular/compiler": "8.0.0", "@angular/core": "8.0.0", "@angular/forms": "8.0.0", "@angular/http": "8.0.0-beta.10", "@angular/platform-browser": "8.0.0", "@angular/platform-browser-dynamic": "8.0.0", "@angular/router": "8.0.0", "@nstudio/nativescript-loading-indicator": "^1.0.0", "@types/lodash": "^4.14.110", "bignumber.js": "^9.0.0", "crypto-js": "^3.1.9-1", "growl": "^1.10.2", "lodash": "^4.17.10", "moment": "^2.22.2", "nativescript-angular": "8.0.2", "nativescript-app-sync": "^1.0.4", "nativescript-carousel": "^6.1.0", "nativescript-couchbase": "^1.0.18", "nativescript-filterable-listpicker": "^2.2.4", "nativescript-localize": "^4.1.1", "nativescript-modal-datetimepicker": "^1.2.0", "nativescript-theme-core": "~1.0.4", "nativescript-toasty": "^2.0.1", "nativescript-ui-autocomplete": "5.0.0", "nativescript-ui-chart": "5.0.0", "nativescript-ui-listview": "^7.0.2", "nativescript-unit-test-runner": "0.7.0", "nativescript-zip": "^3.0.3", "reflect-metadata": "~0.1.8", "rxjs": "^6.3.3", "tns-core-modules": "^6.0.4", "zone.js": "0.9.1" }, "devDependencies": { "@angular/compiler-cli": "8.0.0", "@ngtools/webpack": "8.0.0", "@types/crypto-js": "^3.1.43", "@types/jasmine": "3.3.12", "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", "husky": "^0.14.3", "karma": "4.1.0", "karma-jasmine": "2.0.1", "karma-nativescript-launcher": "0.4.0", "karma-webpack": "3.0.5", "lazy": "1.0.11", "lint-staged": "^7.2.0", "nativescript-css-loader": "~0.26.1", "nativescript-dev-webpack": "1.0.1", "node-sass": "4.12.0", "prettier": "^1.13.7", "tns-platform-declarations": "^6.0.1", "tslib": "~1.9.2", "tslint": "^5.10.0", "typescript": "3.4.5" }, "author": "{me}", "scripts": { "e2e": "tsc -p e2e && mocha --opts ./e2e/config/mocha.opts", "compile-tests": "tsc -p e2e --watch" } }I'm a NS app developer and faced the same error when trying to onboard AppSync today:
file:///node_modules/properties/lib/stringify.js:9:17 JS ERROR TypeError: undefined is not an object (evaluating 'global.process.platform')Followed the standard steps and executed
tns run iosandtns run androidon emulators. Error happens for both platforms.Rather then creating a new issue I thought I'll add this data point here.
Folks, please just share a repo I can look at. Those little snippets are pretty useless on their own.
Folks, please just share a repo I can look at. Those little snippets are pretty useless on their own.
Pushed my change to personal branch: https://github.com/rahultyagiji/foodapp-test/tree/viprsingh
This is the commit specifically: https://github.com/rahultyagiji/foodapp-test/commit/023f7eace8c97c0dbe61bd833d24a547486335ae
Repro steps are to get the repo and execute
tns run iosReacted by Eddy Verbruggen@viprsingh I can't run your app because of an iOS build error on my machine. I noticed you're not running the latest version of the plugin, so bumping that to 1.0.4 in package.json and cleaning the platforms folder and running
npm imay be helpful.@ALL I don't see a direct link between AppSync and the stacktraces you post here, do you? I'd be happy to help, but this is is bit too vague.
@viprsingh I can't run your app because of an iOS build error on my machine. I noticed you're not running the latest version of the plugin, so bumping that to 1.0.4 in package.json and cleaning the platforms folder and running
npm imay be helpful.Updated the plugin but still see the issue: https://github.com/rahultyagiji/foodapp-test/commit/415472418d8070c752027ca1c35dc691e176c43d
Could you please share the iOS build error when running our app? Perhaps I could help with that and you'd be able to repro this issue. You could also try
tns run androidas it seems platform independent.@razorsyntax do you have solid repro steps for @EddyVerbruggen ?
Thanks!
I don't have solid repro steps... actually... I do, but it doesn't make sense. I install app aync and then I get those errors. I uninstall the plugin (remove all node modules/hooks/etc, remove and add the platforms) and then the errors disappear. I haven't been able to figure what the underlying cause is. I can confidently reproduce the errors by installing this plugin. That's all I got so far... I know it's not a good answer but it's all I got at the moment. lol
I'm trying to create a separate repo where I can provide a reproducible code snippet.
@razorsyntax were you able to create the repo? It'll be really helpful. Thanks!
I was able to get app sync working on our app if I only used the iOS emulator. However, on Android emulator, the error comes back. And once the error occurs, then it starts happening on iOS as well. I'm very puzzled.
@jameszonk I'd love to be able to help with that, but the demo app actually is N6 and it works fine for me: https://github.com/EddyVerbruggen/nativescript-app-sync/tree/master/demo .. ideas?
@jameszonk Thanks, I'll bump the demo-ng app in this repo to N6 and see what happens then.
- added a commit that references this issue
on Aug 26, 2019 @jameszonk I've bumped demo-ng to N6 and it all works fine on both platforms (used emulators, but that doesn't matter).
Can you please give this a try?
git clone https://github.com/EddyVerbruggen/nativescript-app-sync cd nativescript-app-sync/src npm i npm run demo-ng.ios # and/or demo-ng.androidThat should install the demo app on your device just fine. At the top of the first page it will say "AppStore version", then look at the log and it should say "update installed". Then kill the app and restart and it should say "CodePush version" at the top of the first page.
This happens to me as well, when I removed the nodemodules resolution like @jameszonk said. It runs without crashing
configuration:
{ "nativescript": { "tns-ios": { "version": "6.0.2" }, "tns-android": { "version": "6.0.2" } }, "dependencies": { "@angular/animations": "~8.0.0", "@angular/common": "~8.0.0", "@angular/compiler": "~8.0.0", "@angular/core": "~8.0.0", "@angular/forms": "~8.0.0", "@angular/http": "~8.0.0-beta.10", "@angular/platform-browser": "~8.0.0", "@angular/platform-browser-dynamic": "~8.0.0", "@angular/router": "~8.0.0", "moment": "^2.24.0", "nativescript-angular": "~8.0.0", "nativescript-app-sync": "^1.0.4", "nativescript-plugin-firebase": "^9.1.0", "nativescript-theme-core": "~1.0.6", "nativescript-toast": "^2.0.0", "nativescript-ui-dataform": "^5.0.0", "nativescript-ui-listview": "^7.0.4", "reflect-metadata": "~0.1.12", "rxjs": "~6.5.0", "tns-core-modules": "^6.0.7", "zone.js": "~0.9.1" }, "devDependencies": { "@angular/compiler-cli": "~8.0.0", "@ngtools/webpack": "~8.0.0", "codelyzer": "~4.5.0", "nativescript-dev-webpack": "~1.1.0", "node-sass": "^4.7.1", "tslint": "~5.11.0", "typescript": "~3.4.0" }, }- I discovered that the angular cli are creating tsconfig with
"paths": { "~/*": [ "src/*" ], "*": [ "./node_modules/*" ] - removed node modules resolution => result => all good plugin works!
Do you mean it looks like this after you removed
node_modules:"paths": { "~/*": [ "src/*" ], "*": [ ]- I discovered that the angular cli are creating tsconfig with
In tsconfig.json...
Before:
"paths": { "~/*": [ "app/*" ], "*": [ "./node_modules/tns-core-modules/*", "./node_modules/*" ] }After:
"paths": { "~/*": [ "app/*" ], "*": [ "./node_modules/tns-core-modules/*", ] }This seemed to have resolved the issue.
Reacted by viprsingh, xiang and Dmitrii VasilevI didn't want to close this until someone else was able to resolve their issue with my last fix.
@razorsyntax This fixed the issue for me as well. :)
- pinned this issue
on Sep 5, 2019 - changed the title
[-]Nativescript Zip error on tns run ios and android[/-][+][TIP] [SOLVED] Nativescript Zip error on tns run ios and android[/+]on Sep 5, 2019 Thanks, @razorsyntax for that tip! I'll link to it from the readme, and pin this issue as well. Btw, I think this issue will be solved if I would push my fork of nativescript-zip to npm. I'm considering doing so.
Reacted by viprsingh and AveeReacted by razorsyntax
When I run
tns run iosI get the following message and the app terminates:The following is the stacktrace:
In main.ts:
Any ideas? This also happens with Android, although with a different stacktrace but similar errors.