2017-10-28 110 views
2

我正在关注官方教程。我现在陷入了第3章。这是很奇怪的,我更多的日志这样NativeScript文件系统错误

Successfully transferred app.routing.ts. 
Successfully transferred app.module.ts. 
Successfully transferred app.module.js. 
Refreshing application... 
Successfully synced application org.nativescript.Groceries on device 2CB64AE2-E31B-4B15-ACA5-B501400C2814. 
1 0x10dac0d4b NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*) 
2 0x10e16428e ffi_closure_unix64_inner 
3 0x10e164bd2 ffi_closure_unix64 
4 0x1107f2245 -[UIViewController __viewWillAppear:] 
5 0x110833aa2 -[UINavigationController _startTransition:fromViewController:toViewController:] 
6 0x11083492f -[UINavigationController _startDeferredTransitionIfNeeded:] 
7 0x110835b90 -[UINavigationController __viewWillLayoutSubviews] 
8 0x110a8c2ae -[UILayoutContainerView layoutSubviews] 
9 0x11071c551 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] 
10 0x1147524ba -[CALayer layoutSublayers] 
11 0x1147565a9 CA::Layer::layout_if_needed(CA::Transaction*) 
12 0x1146df1cd CA::Context::commit_transaction(CA::Transaction*) 
13 0x11470aae4 CA::Transaction::commit() 
14 0x110669706 __34-[UIApplication _firstCommitBlock]_block_invoke_2 
15 0x11282c20c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ 
16 0x112810a3b __CFRunLoopDoBlocks 
17 0x112810214 __CFRunLoopRun 
18 0x11280fa89 CFRunLoopRunSpecific 
19 0x1140179c6 GSEventRunModal 
20 0x11064dd30 UIApplicationMain 
21 0x10e164a2d ffi_call_unix64 
22 0x1353bbc60 
file:///app/tns_modules/nativescript-angular/resource-loader.js:23:101: JS ERROR Error: File /Users/zhouyuan/Library/Developer/CoreSimulator/Devices/2CB64AE2-E31B-4B15-ACA5-B501400C2814/data/Containers/Bundle/Application/C64D6180-4E51-4808-9AD5-09E0B329379A/Groceries.app/app/pages/login/pages/login/login.html does not exist. Resolved from: /Users/zhouyuan/Library/Developer/CoreSimulator/Devices/2CB64AE2-E31B-4B15-ACA5-B501400C2814/data/Containers/Bundle/Application/C64D6180-4E51-4808-9AD5-09E0B329379A/Groceries.app/app/pages/login/pages/login/login.html. 

我敢肯定这应该是/app/pages/login/login.html但错误说app/pages/login/pages/login/login.html.任何人都知道为什么出现这种情况?

回答

1

我猜你正在使用角nativescript看见app.routing.ts

在login.ts你可以这样定义你的组件:

@Component({ 
    selector: "my-app", 
    moduleId: module.id, 
    templateUrl: "./login.html" 
}) 

@Component({ 
    selector: "my-app", 
    templateUrl: "pages/login/login.html", 
}) 

如果你想使用相对路径,添加moduleId: module.id

+0

moduleID实际上是什么意思?我之前使用过Angular,但从未使用过moduleID。 –

+1

@PenguinZhou的回答是否解决了您的问题? about moduleId:https://stackoverflow.com/questions/37178192/angular2-what-is-the-meanings-of-module-id-in-component – Fetrarij

+0

我想我现在对它的工作原理有一个模糊的想法。谢谢! –