未知的编译器选项'文件'启动./node_modules/.bin/ng-xi18n

时间:2017-11-21 22:17:01

标签: angular typescript command-line-interface

为了翻译我的角度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是这样的:

  

&#34; name&#34;:&#34; eheheh&#34;,         &#34;版本&#34;:&#34; 0.0.0&#34;,         &#34;许可证&#34;:&#34; MIT&#34;,         &#34;脚本&#34;:{           &#34; ng&#34;:&#34; ng&#34;,           &#34;开始&#34;:&#34; ng serve&#34;,           &#34;构建&#34;:&#34; ng build&#34;,           &#34;测试&#34;:&#34; ng test&#34;,           &#34; lint&#34;:&#34; ng lint&#34;,           &#34; e2e&#34;:&#34; ng e2e&#34;         },         &#34;私人&#34;:是的,         &#34;依赖&#34;:{           &#34; @ angular / animations&#34;:&#34; ^ 4.4.3&#34;,           &#34; @ angular / cdk&#34;:&#34; ^ 2.0.0-beta.12&#34;,           &#34; @ angular / common&#34;:&#34; ^ 4.2.4&#34;,           &#34; @ angular / compiler&#34;:&#34; ^ 4.2.4&#34;,           &#34; @ angular / core&#34;:&#34; ^ 4.2.4&#34;,           &#34; @ angular / forms&#34;:&#34; ^ 4.2.4&#34;,           &#34; @ angular / http&#34;:&#34; ^ 4.2.4&#34;,           &#34; @ angular / material&#34;:&#34; ^ 2.0.0-beta.12&#34;,           &#34; @ angular / platform-b​​rowser&#34;:&#34; ^ 4.2.4&#34;,           &#34; @ angular / platform-b​​rowser-dynamic&#34;:&#34; ^ 4.2.4&#34;,           &#34; @ angular / router&#34;:&#34; ^ 4.2.4&#34;,           &#34; angular2-uuid&#34;:&#34; ^ 1.1.1&#34;,           &#34; angularfire2&#34;:&#34; ^ 4.0.0-rc.2&#34;,           &#34; bootstrap&#34;:&#34; ^ 3.3.7&#34;,           &#34; core-js&#34;:&#34; ^ 2.4.1&#34;,           &#34; firebase&#34;:&#34; ^ 4.4.0&#34;,           &#34; font-awesome&#34;:&#34; ^ 4.7.0&#34;,           &#34; hammerjs&#34;:&#34; ^ 2.0.8&#34;,           &#34; ng2-markdown-to-html&#34;:&#34; ^ 1.3.2&#34;,           &#34; ng2wig&#34;:&#34; ^ 0.2.1&#34;,           &#34; ngx-loading&#34;:&#34; ^ 1.0.7&#34;,           &#34; rxjs&#34;:&#34; ^ 5.4.2&#34;,           &#34; zone.js&#34;:&#34; ^ 0.8.14&#34;         },         &#34; devDependencies&#34;:{           &#34; @ angular / cli&#34;:&#34; 1.4.3&#34;,           &#34; @ angular / compiler-cli&#34;:&#34; ^ 4.2.4&#34;,           &#34; @ angular / language-service&#34;:&#34; ^ 4.2.4&#34;,           &#34; @ types / jasmine&#34;:&#34; ~2.5.53&#34;,           &#34; @ types / jasminewd2&#34;:&#34; ~2.0.2&#34;,           &#34; @ types / node&#34;:&#34; ~6.0.60&#34;,           &#34; codelyzer&#34;:&#34; ~3.1.1&#34;,           &#34; jasmine-core&#34;:&#34; ~2.6.2&#34;,           &#34; jasmine-spec-reporter&#34;:&#34; ~4.1.0&#34;,           &#34;业力&#34;:&#34; ~1.7.0&#34;,           &#34; karma-chrome-launcher&#34;:&#34; ~2.1.1&#34;,           &#34; karma-cli&#34;:&#34; ~1.0.1&#34;,           &#34; karma-coverage-istanbul-reporter&#34;:&#34; ^ 1.2.1&#34;,           &#34; karma-jasmine&#34;:&#34; ~1.1.0&#34;,           &#34; karma-jasmine-html-reporter&#34;:&#34; ^ 0.2.2&#34;,           &#34;量角器&#34;:&#34; ~5.1.2&#34;,           &#34; ts-node&#34;:&#34; ~3.2.0&#34;,           &#34; tslint&#34;:&#34; ~5.3.2&#34;,           &#34;打字稿&#34;:&#34; ~2.3.3&#34;         }       }

由于

1 个答案:

答案 0 :(得分:4)

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

你可能有:

// tsconfig.json
{
  "compilerOptions": {
    ...
    "files": [ ... ]
  }
}

而不是:

/// tsconfig.json
{
  "compilerOptions": {
    ...
  },
  "files": [ ... ]
}