nativescript-app-sync: [TIP] [SOLVED] Nativescript Zip error on tns run ios and android

When I run tns run ios I get the following message and the app terminates:

ERROR in ../node_modules/nativescript-app-sync/TNSLocalPackage.js
Module not found: Error: Can't resolve 'nativescript-zip' in '/{homefolder}/{App}/{App-Name}/node_modules/nativescript-app-sync'
 @ ../node_modules/nativescript-app-sync/TNSLocalPackage.js 3:25-52
 @ ../node_modules/nativescript-app-sync/app-sync.js
 @ ./main.ts

The following is the stacktrace:

***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1   0x10bffe91f NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2   0x10c044d1f -[TNSRuntime executeModule:referredBy:]
3   0x10b845be3 main
4   0x10ffce541 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:176900: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:176000: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:176900: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   0x10c04384f sig_handler(int)
2   0x11032db5d _sigtramp
3   0xffff00001fa5
4   0x1100b001d abort
5   0x10fe499d1 __cxa_bad_cast
6   0x10fe49b6f default_unexpected_handler()
7   0x10efbbe2d _objc_terminate()
8   0x10fe55a2e std::__terminate(void (*)())
9   0x10fe554eb __cxa_get_exception_ptr
10  0x10fe554b2 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
11  0x10efbbbfa _objc_exception_destructor(void*)
12  0x10bffed58 NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
13  0x10c044d1f -[TNSRuntime executeModule:referredBy:]
14  0x10b845be3 main
15  0x10ffce541 start
JS Stack:
Successfully synced application com.nativescript.{appname} on device 6A1095F3-58DF-4F18-9B22-C284166E3E55.
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1   0x106a8e91f NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2   0x106ad4d1f -[TNSRuntime executeModule:referredBy:]
3   0x1062d5be3 main
4   0x10a98e541 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:176900: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:176000: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:176900: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   0x106ad384f sig_handler(int)
2   0x10acf2b5d _sigtramp
3   0xffff
4   0x10aa7501d abort
5   0x10a8099d1 __cxa_bad_cast
6   0x10a809b6f default_unexpected_handler()
7   0x10997be2d _objc_terminate()
8   0x10a815a2e std::__terminate(void (*)())
9   0x10a8154eb __cxa_get_exception_ptr
10  0x10a8154b2 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
11  0x10997bbfa _objc_exception_destructor(void*)
12  0x106a8ed58 NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
13  0x106ad4d1f -[TNSRuntime executeModule:referredBy:]
14  0x1062d5be3 main
15  0x10a98e541 start
JS Stack:

In main.ts:

import { platformNativeScriptDynamic } from 'nativescript-angular/platform';
import { AppModule } from './app.module';
import { isIOS } from "tns-core-modules/platform";

import * as application from "tns-core-modules/application";
import { AppSync, InstallMode/*, SyncStatus*/ } from 'nativescript-app-sync';

platformNativeScriptDynamic().bootstrapModule(AppModule);

application.on(application.resumeEvent, () => {
  AppSync.sync({
        deploymentKey: isIOS ? 'key1' : 'key2',
        installMode: InstallMode.ON_NEXT_RESTART, // default InstallMode.ON_NEXT_RESTART
        mandatoryInstallMode: isIOS ? InstallMode.ON_NEXT_RESUME : InstallMode.IMMEDIATE, // default InstallMode.ON_NEXT_RESUME
        updateDialog: { // only used for InstallMode.IMMEDIATE
          optionalUpdateMessage: "Updates Available.",
          updateTitle: "Please restart the app",
          mandatoryUpdateMessage: "This app needs to be updated.  Please restart the app.",
          optionalIgnoreButtonLabel: "Later",
          mandatoryContinueButtonLabel: isIOS ? "Exit now" : "Restart now",
          appendReleaseDescription: true // appends the description you (optionally) provided when releasing a new version to AppSync
        }
      });
  });

Any ideas? This also happens with Android, although with a different stacktrace but similar errors.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 23 (7 by maintainers)

Commits related to this issue

Most upvoted comments

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.

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

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

@EddyVerbruggen just tried your demo everything works, and that was very odd, because i did that 😃 To figure out what was different I started to dig.

  1. Created new project tns create HelloWorld --template tns-template-blank-ng => result => all good
  2. added plugin => result => JS ERROR TypeError: undefined is not an object (evaluating 'global.process.platform')
  3. Updated all deps => result => the same exception.
  4. I discovered that the angular cli are creating tsconfig with "paths": { "~/*": [ "src/*" ], "*": [ "./node_modules/*" ]
  5. removed node modules resolution => result => all good plugin works!

Very odd

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.

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 ios