Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular i18n编译失败,带有Sass-未找到资源文件_Angular_Sass - Fatal编程技术网

Angular i18n编译失败,带有Sass-未找到资源文件

Angular i18n编译失败,带有Sass-未找到资源文件,angular,sass,Angular,Sass,在Angular 4应用程序中,我们尝试使用i18n,问题是当我们运行npm run i18n时,我们会收到一个错误“未找到资源文件”: 错误:编译失败。未找到资源文件:C:/Projekte/Git/KWKPortal/App/src/App/core/menu/src/App/shared/style/variables 位于ModuleResolutionHostAdapter.readResource(C:\Projekte\Git\KWKPortal\App\node\u module

在Angular 4应用程序中,我们尝试使用i18n,问题是当我们运行
npm run i18n
时,我们会收到一个错误“未找到资源文件”:

错误:编译失败。未找到资源文件:C:/Projekte/Git/KWKPortal/App/src/App/core/menu/src/App/shared/style/variables 位于ModuleResolutionHostAdapter.readResource(C:\Projekte\Git\KWKPortal\App\node\u modules\@angular\compiler cli\src\compiler\u host.js:387:19) 在CompilerHost.loadResource(C:\Projekte\Git\KWKPortal\App\node\u modules\@angular\compiler cli\src\compiler\u host.js:251:29) 在Object.get(C:\Projekte\Git\KWKPortal\App\node\u modules\@angular\compiler\bundles\compiler.umd.js:27273:103) 在DirectiveNormalizer.获取(C:\Projekte\Git\KWKPortal\App\node\u modules\@angular\compiler\bundles\compiler.umd.js:14095:43) 在C:\Projekte\Git\KWKPortal\App\node\u modules\@angular\compiler\bundles\compiler.umd.js:14211:68 at Array.map(本机) 在DirectiveNormalizer.\u loadMissingExternalStylesheets(C:\Projekte\Git\KWKPortal\App\node\u modules\@angular\compiler\bundles\compiler.umd.js:14211:14) 在C:\Projekte\Git\KWKPortal\App\node\u modules\@angular\compiler\bundles\compiler.umd.js:14214:26 在进程中。_tick回调(内部/process/next_tick.js:109:7) 位于Module.runMain(Module.js:606:11) 提取失败

这就是我导入
变量的方式。scss

@import“src/app/shared/styles/variables”

我还尝试了
.scss
,但没有成功

这是我的文件夹结构:

这是我的
包。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
\u variables.scss

下划线使Sass知道该文件只是部分文件,并且 不应将其生成到CSS文件中。Sass部分是 与@import指令一起使用


对于
toLowerCase
错误:

--i18nFormat=xlf
添加到
package.json

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

在哪里导入variables.scs?文件及其路径?请发布您的package.json-alsoThanks。我用我的文件夹结构和package.json更新了我的问题。'ng build'工作正常…npm安装@angular/{通用、编译器、编译器cli、核心、表单、http、平台浏览器、平台浏览器动态、平台服务器、路由器}@latesttypescript@latest--保存只需运行此命令并重试即可。如果出现错误:+CategoryInfo:ParserError:(:)[],ParentContainesErrorRecordException+FullyQualifiedErrorId:MissingArguments现在看起来好多了,但我仍然有以下错误:
TypeError:无法读取null的属性“toLowerCase”
。你知道那是什么吗?尽管如此,我还是会将此设置为正确答案。不幸的是,我不得不显式地使用扩展名.scss。谢谢:(我已经试过了,我找到了这个链接:我正要发到askokay,试着在你的“i18n”中添加这个链接:“ng-xi18n--i18nFormat=xlf”,然后运行:npm run i18nYES!谢谢…我现在已经生成了文件