Description
Environment
Provide version numbers for the following components (information can be retrieved by running tns info
in your project folder or by inspecting the package.json
of the project):
tns version 5.0.1
✔ Component nativescript has 5.0.1 version and is up to date.
✔ Component tns-core-modules has 5.0.3 version and is up to date.
✔ Component tns-android has 5.0.0 version and is up to date.
✔ Component tns-ios has 5.0.0 version and is up to date.
Mac os x 10.14.1
VSCode 1.29.1
Node 10.13.0
Describe the bug
runtime exception when trying to navigate
CONSOLE WARN file:///app/tns_modules/tns-core-modules/application/application.js:273:26: Fatal JavaScript exception - application has been terminated.
file:///app/tns_modules/tns-core-modules/ui/frame/frame.js:49:57: JS ERROR TypeError: undefined is not an object (evaluating 'backstackEntry.resolvedPage.ios')
To Reproduce
clone blank template (tns create my-blank-js --template tns-template-blank)
add page-two.js & page-two.xml files (see below)
modify home-page.xml to add a Label with a tap to home-page.xml
modify home-page.js to export a function to navigate on the tap
run the project in the VSCode Debugger
tap the 'go to page two' label
get exception [above]
- here is the full console output
[NativeScriptCli] execute: tns --analyticsClient VSCode --version
Version: 0.8.3
Build version: v.2018.10.19.1
Commit id: 3d1f5eb4413af34503e018fe35ccf21831c4b1d9
NativeScript CLI: 5.0.1
[NativeScriptCli] execute: tns --analyticsClient VSCode --version
[NSDebugAdapter] Using tns CLI v5.0.1 on path 'tns'
[NSDebugAdapter] Running tns command...
[NativeScriptCli] execute: tns --analyticsClient VSCode debug ios --watch
[NSDebugAdapter] Watching the tns CLI output to receive a connection token
Searching for devices...
Executing before-watchPatterns hook from /Users/ajoslin/Documents/Als/Development/NativeScript/my-blank-js/hooks/before-watchPatterns/nativescript-dev-webpack.js
Executing before-watch hook from /Users/ajoslin/Documents/Als/Development/NativeScript/my-blank-js/hooks/before-watch/nativescript-dev-webpack.js
Executing before-shouldPrepare hook from /Users/ajoslin/Documents/Als/Development/NativeScript/my-blank-js/hooks/before-shouldPrepare/nativescript-dev-webpack.js
Skipping prepare.
Successfully transferred all files on device DB836343-1BA7-4D2B-B19C-3C8E4B1C0411.
org.nativescript.myblankjs: org.nativescript.myblankjs: 71224
Setting up debugger proxy...
Press Ctrl + C to terminate, or disconnect.
Opened localhost 41000
To start debugging, open the following URL in Chrome:
chrome-devtools://devtools/remote/serve_file/@02e6bde1bbe34e43b309d4ef774b1168d25fd024/inspector.html?experiments=true&ws=localhost:41000
Successfully synced application org.nativescript.myblankjs on device DB836343-1BA7-4D2B-B19C-3C8E4B1C0411.
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
import weakref
File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
[NSDebugAdapter] Ready to attach to application on 41000
Frontend client connected.
NativeScript debugger has opened inspector socket on port 18183 for org.nativescript.myblankjs.
Backend socket created.
CONSOLE LOG file:///app/tns_modules/tns-core-modules/inspector_modules.js:1:82: Loading inspector modules...
CONSOLE LOG file:///app/tns_modules/tns-core-modules/inspector_modules.js:6:12: Finished loading inspector modules.
NativeScript debugger attached.
CONSOLE LOG file:///app/home/home-page.js:16:16: HomeViewModel Tap
CONSOLE WARN file:///app/tns_modules/tns-core-modules/application/application.js:273:26: Fatal JavaScript exception - application has been terminated.
file:///app/tns_modules/tns-core-modules/ui/frame/frame.js:49:57: JS ERROR TypeError: undefined is not an object (evaluating 'backstackEntry.resolvedPage.ios')
Expected behavior
to see page two
Sample project
start with blank template
add page-two.js [empty file]
add page-two.xml
<Page class="page"
xmlns="http://schemas.nativescript.org/tns.xsd">
<ActionBar class="action-bar">
<Label class="action-bar-title" text="Page Two"></Label>
</ActionBar>
</Page>
modify home-page.xml to insert a Label into the GridLayout
<Label tap="gotoPageTwo" text="Go To Page Two"></Label>
modify home-page.js to add&export a tap function
function gotoPageTwo(args) {
console.log("HomeViewModel Tap");
frameModule.topmost().navigate("page-two");
}
exports.gotoPageTwo = gotoPageTwo;
Additional context
I've been reading everything I can find about navigation and looking at other samples - I know I'm missing something... (or it would be working) -- but on the off chance that something is missing in the given configs, or a tip can be added to aid too-weary-too-soon travelers...
Thank you for your time and attention