Nativescript在错误的地方寻找Nativescript-theme-core?

时间:2016-12-27 15:29:39

标签: css angular nativescript

我正忙着一个非常简单的条码扫描器应用程序,并在应用程序部署到genymotion模拟器后出现一个奇怪的错误......似乎它正在寻找错误位置的核心主题?知道为什么会发生这种情况以及如何尝试修复它吗?

我的错误:

JS: ns-renderer: ERROR BOOTSTRAPPING ANGULAR
JS: ns-renderer: File /data/data/org.nativescript.barcodescanner/files/app/nativescript-theme-core/css/core.dark.css does not exist. Resolved from: nativescript-theme-core/css/core.dark.css.
JS:
JS: Error: File /data/data/org.nativescript.barcodescanner/files/app/nativescript-theme-core/css/core.dark.css does not exist. Resolved from: nativescript-theme-core/css/core.dark.css.
JS:     at FileSystemResourceLoader.get (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/nativescript-angular/resource-loader.js:22:19)
JS:     at DirectiveNormalizer._fetch (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/@angular/compiler/bundles/compiler.umd.js:13661:45)
JS:     at /data/data/org.nativescript.barcodescanner/files/app/tns_modules/@angular/compiler/bundles/compiler.umd.js:13761:55
JS:     at Array.map (native)
JS:     at DirectiveNormalizer._loadMissingExternalStylesheets (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/@angular/compiler/bundles/compiler.umd.js:13761:16)
JS:     at /data/data/org.nativescript.barcodescanner/files/app/tns_modules/@angular/compiler/bundles/compiler.umd.js:13764:28
JS:     at ZoneDelegate.invoke (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:190:28)
JS:     at Zone.run (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:83:43)
JS:     at /data/data/org.nativescript.barcodescanner/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:449:57
JS:     at ZoneDelegate.invokeTask (/data/data/org.nativescript.barcodescanner/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:223:37)

my app.css:

@import 'nativescript-theme-core/css/core.dark.css';

and in my app.component.css:

    styleUrls: ['./app.css']

1 个答案:

答案 0 :(得分:1)

在您的 app.css 中,您应该

@import 'nativescript-theme-core/css/core.dark.css';

app.component.ts 中删除对app.css的显式调用。 因为app.css中的样式默认情况下会在应用程序中全局显示,所以不需要它。有关详细信息,请参阅this comment