Skip to content

Plugin causes Angular apps to crash #42

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
tjvantoll opened this issue Oct 2, 2019 · 7 comments
Closed

Plugin causes Angular apps to crash #42

tjvantoll opened this issue Oct 2, 2019 · 7 comments
Assignees
Labels
Milestone

Comments

@tjvantoll
Copy link

Hey @EddyVerbruggen,

Went to add this plugin to a new app today and noticed that it causes the app to crash at runtime with a somewhat cryptic error.

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
../node_modules/properties/lib/stringify.js(file:///node_modules/properties/lib/stringify.js:9:17)
at __webpack_require__(file:///src/webpack/bootstrap:750:0)

You can recreate the problem pretty simply.

  1. Start a new app. (I used the default Angular drawer template.)
  2. tns plugin add nativescript-app-sync
  3. tns run ios --emulator

I’ll try to debug a bit and see if this is related to the new version, or maybe the type of app.

@tjvantoll
Copy link
Author

Hmmm... the plugin works fine with the Hello World TypeScript template. Maybe it’s something about the Angular drawer template.

@tjvantoll tjvantoll changed the title Plugin causes app crash Plugin causes Angular apps to crash Oct 2, 2019
@tjvantoll
Copy link
Author

Also fails with the Angular Hello World template. Looks like this is something specific to Angular... but I have no idea what :(

@EddyVerbruggen
Copy link
Contributor

Hey @tjvantoll! I can reproduce this with your steps. Thanks for reporting it, I'll try to look into it asap.

@EddyVerbruggen
Copy link
Contributor

EddyVerbruggen commented Oct 2, 2019

Looks like the template recently changed this line

https://github.com/EddyVerbruggen/nativescript-app-sync/blob/27b4247e44827749808570e58ac85d4db65e82b7/demo-ng/tsconfig.tns.json#L4

to "module": "esNext" because of this change .. without that change there's no problem.

I'll have to look into making the plugin compatible with that change.

@EddyVerbruggen EddyVerbruggen self-assigned this Oct 2, 2019
@EddyVerbruggen EddyVerbruggen added this to the 1.0.7 milestone Oct 2, 2019
@EddyVerbruggen
Copy link
Contributor

EddyVerbruggen commented Oct 2, 2019

Please update to 1.0.7 - it's esNext compatible.

One note about version 1.0.6 and up: if you want the plugin to sync when hmr is enabled (like with tns run ios), you'll have to pass in enabledWhenUsingHmr: true as seen because AppSync and hmr bite each other (which is quite obvious if you think about it).

If you don't pass that in, this line will be executed.

@tjvantoll
Copy link
Author

That fixed it 🎉 Thanks @EddyVerbruggen for the super fast response!

@sebastien-bisson-dm
Copy link

Hello,

We have encountered this issue recently with the latest version "2.0.2" on an ios ipad.
" JS ERROR TypeError: undefined is not an object (evaluating 'global.process.platform')"
with the following tack trace:

"Terminating app due to uncaught exception 'NativeScript encountered a fatal error: TypeError: undefined is not an object (evaluating 'global.process.platform')
at
../node_modules/properties/lib/stringify.js(file:///app/vendor.js:110862:25)
at webpack_require(file:///app/runtime.js:75:34)
at ../node_modules/properties/lib/write.js(file:///app/vendor.js:111076:36)
at webpack_require(file:///app/runtime.js:75:34)
at ../node_modules/properties/lib/index.js(file:///app/vendor.js:110039:32)
at webpack_require(file:///app/runtime.js:75:34)
at file:///app/vendor.js:143089:39
at ../node_modules/tns-core-modules/ui/core/bindable/bindable.js(file:///app/vendor.js:143588:34)
at webpack_require(file:///app/runtime.js:75:34)
at file:///app/vendor.js:142517:37
at ../node_modules/tns-core-modules/ui/builder/component-builder/component-builder.js(file:///app/vendor.js:142686:34)
at webpack_require(file:///app/runtime.js:75:34)
at file:///app/vendor.js:141978:46
at ../node_modules/tns-core-modules/ui/builder/builder.js(file:///app/vendor.js:142509:34)
at webpack_require(file:///app/runtime.js:75:34)
at file:///app/vendor.js:128395:36
at ../node_modules/tns-core-modules/application/application.js(file:///app/vendor.js:128773:34)
at webpack_require(file:///app/runtime.js:75:34)
at file:///app/vendor.js:95299:20
at ../node_modules/nativescript-angular/platform-common.js(file:///app/vendor.js:95618:34)
at webpack_require(file:///app/runtime.js:75:34)
at file:///app/vendor.js:95721:44
at ../node_modules/nativescript-angular/platform.js(file:///app/vendor.js:95764:34)
at webpack_require(file:///app/runtime.js:75:34)
at ./main.ts(file:///app/bundle.js:2369:106)
at webpack_require(file:///app/runtime.js:75:34)
at checkDeferredModules(file:///app/runtime.js:44:42)
at webpackJsonpCallback(file:///app/runtime.js:31:39)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at moduleEvaluation([native code])
at [native code]
at asyncFunctionResume([native code])
at [native code]"

We are using nativescript 6 and here it is the tns doctor result:
tns doctor
✔ Getting environment information

No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Xcode version 13.2.1 satisfies minimum required version 10.
✔ Getting NativeScript components versions information...
⚠ Update available for component nativescript. Your current version is 6.1.2 and the latest available version is 8.1.5.
⚠ Update available for component tns-core-modules. Your current version is 6.1.2 and the latest available version is 6.5.27.
⚠ Update available for component tns-android. Your current version is 6.1.2 and the latest available version is 6.5.3.
⚠ Update available for component tns-ios. Your current version is 6.5.2 and the latest available version is 6.5.4.

Did we miss something?
Any help could be usefull.

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

No branches or pull requests

3 participants