未知编译器选项“文件”正在启动 ./node_modules/.bin/ng-xi18n

Posted

技术标签:

【中文标题】未知编译器选项“文件”正在启动 ./node_modules/.bin/ng-xi18n【英文标题】:Unknown compiler option 'files' launching ./node_modules/.bin/ng-xi18n 【发布时间】:2018-05-05 13:00:06 【问题描述】:

为了翻译我的 Angular 4 应用程序,我正在尝试启动

./node_modules/.bin/ng-xi18n 来自根目录,但我遇到了问题,这是我的日志:

    Error: Error Unknown compiler option 'files'.
    at UserError.Error (native)
    at new UserError (/Users/danilodughetti/Coding/creatiweapp/creatiwe/node_modules/@angular/tsc-wrapped/src/tsc.js:27:28)
    at check (/Users/danilodughetti/Coding/creatiweapp/creatiwe/node_modules/@angular/tsc-wrapped/src/tsc.js:93:15)
    at Tsc.readConfiguration (/Users/danilodughetti/Coding/creatiweapp/creatiwe/node_modules/@angular/tsc-wrapped/src/tsc.js:152:9)
    at Object.main (/Users/danilodughetti/Coding/creatiweapp/creatiwe/node_modules/@angular/tsc-wrapped/src/main.js:65:28)
    at Object.<anonymous> (/Users/danilodughetti/Coding/creatiweapp/creatiwe/node_modules/@angular/compiler-cli/src/extract_i18n.js:16:9)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
Extraction failed

我的 package.js 是这样的:

"name": "eheheh", “版本”:“0.0.0”, “许可证”:“麻省理工学院”, “脚本”: “ng”:“ng”, “开始”:“ng服务”, “构建”:“ng构建”, “测试”:“ng测试”, “lint”:“ng lint”, “e2e”:“ng e2e” , “私人”:真的, “依赖”: "@angular/animations": "^4.4.3", "@angular/cdk": "^2.0.0-beta.12", "@angular/common": "^4.2.4", "@angular/compiler": "^4.2.4", "@angular/core": "^4.2.4", "@angular/forms": "^4.2.4", "@angular/http": "^4.2.4", "@angular/material": "^2.0.0-beta.12", "@angular/platform-b​​rowser": "^4.2.4", "@angular/platform-b​​rowser-dynamic": "^4.2.4", "@angular/router": "^4.2.4", "angular2-uuid": "^1.1.1", "angularfire2": "^4.0.0-rc.2", “引导程序”:“^3.3.7”, "core-js": "^2.4.1", “火力基地”:“^4.4.0”, "字体真棒": "^4.7.0", "hammerjs": "^2.0.8", "ng2-markdown-to-html": "^1.3.2", "ng2wig": "^0.2.1", "ngx-loading": "^1.0.7", "rxjs": "^5.4.2", “zone.js”:“^0.8.14” , “开发依赖”: "@angular/cli": "1.4.3", "@angular/compiler-cli": "^4.2.4", "@angular/language-service": "^4.2.4", "@types/jasmine": "~2.5.53", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "~3.1.1", “茉莉花核”:“~2.6.2”, "jasmine-spec-reporter": "~4.1.0", "业力": "~1.7.0", "karma-chrome-launcher": "~2.1.1", “业力-cli”:“〜1.0.1”, “业力覆盖伊斯坦布尔记者”:“^1.2.1”, “业力茉莉花”:“〜1.1.0”, “karma-jasmine-html-reporter”:“^0.2.2”, “量角器”:“~5.1.2”, "ts-node": "~3.2.0", "tslint": "~5.3.2", “打字稿”:“~2.3.3”

谢谢

【问题讨论】:

检查您的tsconfig.json。它可能无效(在compileOptions 下有files 谢谢。解决了! 【参考方案1】:

当您看到 TypeScript 项目的 Error Unknown compiler option 'files' 时,很可能您的 tsconfig.json 不正确。

你可能有:

// tsconfig.json

  "compilerOptions": 
    ...
    "files": [ ... ]
  

而不是:

/// tsconfig.json

  "compilerOptions": 
    ...
  ,
  "files": [ ... ]

【讨论】:

是的,我已经解决了包含和排除标签,但答案是正确的再见! 你救了我。谢谢!

以上是关于未知编译器选项“文件”正在启动 ./node_modules/.bin/ng-xi18n的主要内容,如果未能解决你的问题,请参考以下文章

Angular 2 提前编译中的未知编译器选项“angularCompilerOptions”

编译 alamofire 的错误 - 未知选项字符“X”在:-Xlinker

错误 TS5023:未知的编译器选项“strictTemplates”

如何在.vue文件中将选项传递给SASS加载器以获取样式?

错误未知配置变量'advanced-telemetry'

Xamarin proguard.ParseException:文件“Properties/proguard.cfg”的第 1 行中的未知选项“”