Vishal Sahody
Vishal Sahody

Reputation: 1

Upgrading NativeScript app from 3 to 7, any advice?

I have an app built around 2015 which is in desperate need of an upgrade. I have tried following the upgrade instructions on https://docs.nativescript.org/releases/upgrade-instructions and after struggling to get the compiler working I am now getting a whole stack of error which looks like Angular failing to load the app.

I am reaching out to the broader community to see if anyone has done something similar or if there are additional guidelines for upgrade old NativeScript apps build using Angular back in 2015.

Any advice is welcome :-)

This is the latest log output:


                File change detected. Starting incremental webpack compilation...
                Hash: 930f5656308d0b87060d
                Version: webpack 4.27.1
                Time: 7955ms
                Built at: 11/12/2020 11:12:59 AM
                                                  Asset       Size   Chunks             Chunk Names
                         app/images/home_background.png    256 KiB           [emitted]
                app/images/incident_map_placeholder.png    242 KiB           [emitted]
                       app/images/placeholder_image.png   7.62 KiB           [emitted]
                                              bundle.js    157 KiB   bundle  [emitted]  bundle
                                           package.json  112 bytes           [emitted]
                                             runtime.js   71.4 KiB  runtime  [emitted]  runtime
                                    tns-java-classes.js    0 bytes           [emitted]
                                              vendor.js   5.89 MiB   vendor  [emitted]  vendor
                Entrypoint bundle = runtime.js vendor.js bundle.js
                [./main.ts] 12.9 KiB {bundle} [built]
                    + 368 hidden modules

                WARNING in Lazy routes discovery is not enabled. Because there is neither an entryModule nor a statically analyzable bootstrap code in the main file.
                Webpack compilation complete. Watching for file changes.
                Webpack build done!

                ERROR in src/main.ts(226,3): error TS2304: Cannot find name 'firebase'.
                src/main.ts(287,20): error TS2304: Cannot find name 'iosUuidModule'.

                Updating runtime package.json with configuration values...
                Project successfully prepared (android)
                Building project...
                Gradle build...
                         + setting applicationId
                         + applying user-defined configuration from C:\pathtoproject\nativescript\xxx\App_Resources\Android\app.gradle
                         + using android X library androidx.legacy:legacy-support-v4:1.0.0
                         + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
                         + adding aar plugin dependency: C:\pathtoproject\nativescript\xxx\node_modules\nativescript-loading-indicator\platforms\android\nativescript_loading_indicator.aar
                         + adding aar plugin dependency: C:\pathtoproject\nativescript\xxx\node_modules\@nativescript\core\node_modules\tns-core-modules-widgets\platforms\android\widgets-release.aar
                Project successfully built.
                The build result is located at: C:\pathtoproject\nativescript\xxx\platforms\android\app\build\outputs\apk\debug\app-debug.apk
                Installing on device emulator-5554...
                Successfully installed on device with identifier 'emulator-5554'.
                Restarting application on device emulator-5554...
                Successfully synced application au.com.xxx.app on device emulator-5554.
                JS: HMR: Hot Module Replacement Enabled. Waiting for signal.
                System.err: An uncaught Exception occurred on "main" thread.
                System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
                System.err: TypeError: application.start is not a function
                System.err: File: (file:///data/data/au.com.xxx.app/files/app/bundle.js:658:12)
                System.err:
                System.err: StackTrace:
                System.err: (file:///data/data/au.com.xxx.app/files/app/bundle.js:658:13)
                System.err:     at ./main.ts(file:///data/data/au.com.xxx.app/files/app/bundle.js:664:30)
                System.err:     at __webpack_require__(file: src\webpack\bootstrap:750:0)
                System.err:     at checkDeferredModules(file: src\webpack\bootstrap:43:0)
                System.err:     at webpackJsonpCallback(file: src\webpack\bootstrap:30:0)
                System.err:     at (file:///data/data/au.com.xxx.app/files/app/bundle.js:2:57)
                System.err:     at require(:1:266)
                System.err:
                System.err:
                System.err: TypeError: application.start is not a function
                System.err:
                System.err: StackTrace:
                System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
                System.err: TypeError: application.start is not a function
                System.err: File: (file:///data/data/au.com.xxx.app/files/app/bundle.js:658:12)
                System.err:
                System.err: StackTrace:
                System.err: (file:///data/data/au.com.xxx.app/files/app/bundle.js:658:13)
                System.err:     at ./main.ts(file:///data/data/au.com.xxx.app/files/app/bundle.js:664:30)
                System.err:     at __webpack_require__(file: src\webpack\bootstrap:750:0)
                System.err:     at checkDeferredModules(file: src\webpack\bootstrap:43:0)
                System.err:     at webpackJsonpCallback(file: src\webpack\bootstrap:30:0)
                System.err:     at (file:///data/data/au.com.xxx.app/files/app/bundle.js:2:57)
                System.err:     at require(:1:266)
                System.err:
                System.err:
                System.err: TypeError: application.start is not a function
                System.err:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6465)
                System.err:     at android.app.ActivityThread.access$1300(ActivityThread.java:219)
                System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
                System.err:     at android.os.Handler.dispatchMessage(Handler.java:107)
                System.err:     at android.os.Looper.loop(Looper.java:214)
                System.err:     at android.app.ActivityThread.main(ActivityThread.java:7356)
                System.err:     at java.lang.reflect.Method.invoke(Native Method)
                System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
                System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
                System.err: Caused by: com.tns.NativeScriptException: Error calling module function
                System.err: TypeError: application.start is not a function
                System.err: File: (file:///data/data/au.com.xxx.app/files/app/bundle.js:658:12)
                System.err:
                System.err: StackTrace:
                System.err: (file:///data/data/au.com.xxx.app/files/app/bundle.js:658:13)
                System.err:     at ./main.ts(file:///data/data/au.com.xxx.app/files/app/bundle.js:664:30)
                System.err:     at __webpack_require__(file: src\webpack\bootstrap:750:0)
                System.err:     at checkDeferredModules(file: src\webpack\bootstrap:43:0)
                System.err:     at webpackJsonpCallback(file: src\webpack\bootstrap:30:0)
                System.err:     at (file:///data/data/au.com.xxx.app/files/app/bundle.js:2:57)
                System.err:     at require(:1:266)
                System.err:
                System.err:
                System.err: TypeError: application.start is not a function
                System.err:     at com.tns.Runtime.runModule(Native Method)
                System.err:     at com.tns.Runtime.runModule(Runtime.java:674)
                System.err:     at com.tns.Runtime.run(Runtime.java:666)
                System.err:     at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
                System.err:     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1182)
                System.err:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6460)
                System.err:     ... 8 more

Upvotes: 0

Views: 465

Answers (1)

Patrick
Patrick

Reputation: 37

The first three system error lines point to the (initial?) clue:

System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to create application com.tns.NativeScriptApplication:com.tns.NativeScriptException: Error calling module function
System.err: TypeError: application.start is not a function

I'm guessing in your entry point file (main.ts?) the imports are not correct for NS7.

Upvotes: 0

Related Questions