Skip to content
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

[TIP] [SOLVED] Nativescript Zip error on tns run ios and android #34

Open
razorsyntax opened this issue Aug 8, 2019 · 23 comments
Open

Comments

@razorsyntax
Copy link

razorsyntax commented Aug 8, 2019

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.

@razorsyntax razorsyntax changed the title Nativescript Zip error on tns run ios Nativescript Zip error on tns run ios and android Aug 8, 2019
@EddyVerbruggen
Copy link
Contributor

Do you run this on a device as a standalone app? Which command to run the app?

@razorsyntax
Copy link
Author

razorsyntax commented Aug 8, 2019

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 install and then by deleting the folders directly and reinstalling.

I've tried running tns run ios from a terminal and from Sidekick. This error also occurs with tns 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+?

@razorsyntax
Copy link
Author

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:

@razorsyntax
Copy link
Author

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

@viprsingh
Copy link

viprsingh commented Aug 9, 2019

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 ios and tns run android on emulators. Error happens for both platforms.

Rather then creating a new issue I thought I'll add this data point here.

@EddyVerbruggen
Copy link
Contributor

Folks, please just share a repo I can look at. Those little snippets are pretty useless on their own.

@viprsingh
Copy link

viprsingh commented Aug 9, 2019

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

@EddyVerbruggen
Copy link
Contributor

@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 i may 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
Copy link

viprsingh commented Aug 9, 2019

@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 i may 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 android as it seems platform independent.

@razorsyntax do you have solid repro steps for @EddyVerbruggen ?

Thanks!

@razorsyntax
Copy link
Author

razorsyntax commented Aug 11, 2019

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.

@viprsingh
Copy link

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

@ghost
Copy link

ghost commented Aug 26, 2019

Plugin is working only with nativescript@~5. With nativescript@6 I get the same errors as mentioned before.

@EddyVerbruggen
Copy link
Contributor

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

@ghost
Copy link

ghost commented Aug 26, 2019

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

yes, you are absolutely right it is working for nativescript 6 but not with angular. My mistake i totally forgot mention that its not working with angular and nativescript 6. For angular and nativescript 5x it works like a charm

@EddyVerbruggen
Copy link
Contributor

@jameszonk Thanks, I'll bump the demo-ng app in this repo to N6 and see what happens then.

@EddyVerbruggen
Copy link
Contributor

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

@ghost
Copy link

ghost commented 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.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

@siavee
Copy link

siavee commented Aug 26, 2019

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

@razorsyntax
Copy link
Author

razorsyntax commented Aug 26, 2019

@jameszonk

  1. I discovered that the angular cli are creating tsconfig with "paths": { "~/*": [ "src/*" ], "*": [ "./node_modules/*" ]
  2. removed node modules resolution => result => all good plugin works!

Do you mean it looks like this after you removed node_modules: "paths": { "~/*": [ "src/*" ], "*": [ ]

@razorsyntax
Copy link
Author

razorsyntax commented Aug 31, 2019

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.

@razorsyntax
Copy link
Author

I didn't want to close this until someone else was able to resolve their issue with my last fix.

@BenSjoberg
Copy link

@razorsyntax This fixed the issue for me as well. :)

@EddyVerbruggen EddyVerbruggen pinned this issue Sep 5, 2019
@EddyVerbruggen EddyVerbruggen changed the title Nativescript Zip error on tns run ios and android [TIP] [SOLVED] Nativescript Zip error on tns run ios and android Sep 5, 2019
@EddyVerbruggen
Copy link
Contributor

EddyVerbruggen commented 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.

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

No branches or pull requests

5 participants