i18n编译失败,Sass - 找不到资源文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了i18n编译失败,Sass - 找不到资源文件相关的知识,希望对你有一定的参考价值。

在我们的Angular 4应用程序中,我们正在尝试使用i18n,问题是当我们运行npm run i18n时,我们收到错误'找不到资源文件':

错误:编译失败。未找到资源文件:C:/ Projekte / Git / KWKPortal / App / src / app / core / menu / src / app /共享/样式/变量在ModuleResolutionHostAdapter.readResource(C: Projekte Git KWKPortal App node_modules @angular compiler-cli src compiler_host.js:387:19)在CompilerHost.loadResource(C: Projekte Git KWKPortal App node_modules @angular compiler-cli src compiler_host.js:251 :29)在DirectiveNormalizer._fetch(C: Projekte Git )的Object.get(C: Projekte Git KWKPortal App node_modules @angular compiler bundles compiler.umd.js:27273:103) KWPPortal App node_modules @angular compiler bundles compiler.umd.js:14095:43)在C: Projekte Git KWKPortal App node_modules @angular compiler bundles compiler.umd.js: 14211:68在Array.map(native)处于C: Projekte的DirectiveNormalizer._loadMissingExternalStylesheets(C: Projekte Git KWKPortal App node_modules @angular compiler bundles compiler.umd.js:14211:14) git KWKPortal App node_modules @angular compiler bundles compiler.umd.js:14214:26 at process._tickCallback(in在Module.runMain上的ternal / process / next_tick.js:109:7)(module.js:606:11)提取失败

这就是我导入variables.scss的方式:

@import "src/app/shared/styles/variables";

我也尝试过使用.scss而且没用。

那是我的文件夹结构:

enter image description here

这是我的package.json

{
  "name": "app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "i18n": "ng-xi18n"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.1.3",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "@progress/kendo-angular-dropdowns": "^1.0.10",
    "@progress/kendo-angular-l10n": "^1.0.0",
    "@progress/kendo-angular-layout": "^1.0.3",
    "@progress/kendo-theme-default": "^2.37.1",
    "core-js": "^2.4.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.0.3",
    "@angular/compiler-cli": "^4.0.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "node-sass": "^4.5.3",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.2.0"
  }
}
答案

对于Sass - 找不到资源文件

改变你的路径:

@import "../../shared/styles/variables";

和文件名:

variables.scss_variables.scss

下划线让Sass知道该文件只是一个部分文件,不应该生成CSS文件。 Sass partials与@import指令一起使用。


对于toLowerCase错误:

--i18nFormat=xlf添加package.json

"i18n": "ng-xi18n --i18nFormat=xlf"

以上是关于i18n编译失败,Sass - 找不到资源文件的主要内容,如果未能解决你的问题,请参考以下文章

vs2019源码编译qt5.16失败

Android studio 加载Java和资源文件出错

gulp-sass:错误 - 找不到要导入的文件或不可读

安装了vs2019 编译node-sass node-gyp 找不到编译器的解决方法

webpack4打包失败提示node sass找不到你当前环境绑定的解决方法

Android:资源联动失败,找不到文件