Nativescript: TNS preview throws an error on iOS

Created on 18 Feb 2019  ·  5Comments  ·  Source: NativeScript/NativeScript

Environment

✔ Component nativescript has 5.2.0 version and is up to date.
✔ Component tns-core-modules has 5.2.0 version and is up to date.
✔ Component tns-android has 5.2.0 version and is up to date.
✔ Component tns-ios has 5.2.0 version and is up to date.

  • Plugin(s): No plugins added

Describe the bug
Created the Vue project using tns create HelloWorld, then chose Vue.js template.

Then went to my HelloWorld folder and typed tns preview, then scanned QR code with an iPhone (in my case 8 plus with ios 12), then got an error "Oops, something went wrong...":

2019-02-18 22:45:21.947 nsplaydev[1559:427740] ***** Fatal JavaScript exception - application has been terminated. *****
2019-02-18 22:45:21.947 nsplaydev[1559:427740] Native stack trace:
1   0x103407370 NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2   0x103443c20 -[TNSRuntime executeModule:referredBy:]
3   0x10315f3c8 -[UIApplication(PlayLiveSync) swizzled_executeModule:]
4   0x102bc73f0
5   0x232b36bb4 <redacted>
2019-02-18 22:45:21.948 nsplaydev[1559:427740] JavaScript stack trace:
2019-02-18 22:45:21.948 nsplaydev[1559:427740] 1   resolveSync@[native code]
2   @[native code]
3   promiseReactionJob@[native code]
2019-02-18 22:45:21.948 nsplaydev[1559:427740] JavaScript error:
[native code]: JS ERROR Error: Could not find module './components/Home'. Computed path '/var/mobile/Containers/Data/Application/541AB3BA-D3C5-4967-B30B-2623BF32AE2D/Documents/Playground/LiveSync/app/components/Home'.
2019-02-18 22:45:21.949 nsplaydev[1559:427740] PlayLiveSync: Uncaught Exception
2019-02-18 22:45:21.950 nsplaydev[1559:427740] *** JavaScript call stack:
(

)
2019-02-18 22:45:21.950 nsplaydev[1559:427740] *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Error: Could not find module './components/Home'. Computed path '/var/mobile/Containers/Data/Application/541AB3BA-D3C5-4967-B30B-2623BF32AE2D/Documents/Playground/LiveSync/app/components/Home'.
 at 
1   resolveSync@[native code]
2   @[native code]
3   promiseReactionJob@[native code]
', reason: '(null)'
*** First throw call stack:
(0x2330edea4 0x2322bda50 0x1034077b4 0x103443c20 0x10315f3c8 0x102bc73f0 0x232b36bb4)
libc++abi.dylib: terminating with uncaught exception of type NSException
2019-02-18 22:45:21.950 nsplaydev[1559:427740] PlayLiveSync: Uncaught Exception

It should be running my app on my phone via playground.

Most helpful comment

Hey everyone, I had the same issue and --bundle was not working for me as well.

After trying a lot of things, including uninstalling devtools, what solved the problem was uninstalling NativeScript Playground and Preview and install it again.

Other thing that I was making and I suppose it's an error prone behaviour, that keeps the app stuck, is after the error closing both applications and opening them again.

If you have an error on the Preview don't close the app. Just switch to the Playground, scan the QR Code again, and wait for Preview to update.

Hope this helps someone cause I was getting crazy with this shenanigan ❤️

All 5 comments

Hi @heihachi88,
NativeScript Vue projects are using webpack by default and you need to build the project using tns preview --bundle command

Same error with --bundle

Make sure that you have restarted the Preview app before deploying the app via preview command. If the problem persists, please send us the project.

Hey everyone, I had the same issue and --bundle was not working for me as well.

After trying a lot of things, including uninstalling devtools, what solved the problem was uninstalling NativeScript Playground and Preview and install it again.

Other thing that I was making and I suppose it's an error prone behaviour, that keeps the app stuck, is after the error closing both applications and opening them again.

If you have an error on the Preview don't close the app. Just switch to the Playground, scan the QR Code again, and wait for Preview to update.

Hope this helps someone cause I was getting crazy with this shenanigan ❤️

If your ios application throws an exception using tns preview, and then, you fix this exception, when you start again with tns preview, the preview application not can detect your fix and you need reinstall the preview application. It's is terrible for devs that not have ios operational systems like me. It's a bug =(.

Was this page helpful?
0 / 5 - 0 ratings