Unknown compiler option 'files' launching ./node_modules/.bin/ng-xi18n

2017-11-22 angular typescript command-line-interface

In order to translate my angular 4 app I'm trying to launch

./node_modules/.bin/ng-xi18n from the root directory but I'm facing a problem and here is my log :

    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

my package.js is like this :

"name": "eheheh", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@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-browser": "^4.2.4", "@angular/platform-browser-dynamic": "^4.2.4", "@angular/router": "^4.2.4", "angular2-uuid": "^1.1.1", "angularfire2": "^4.0.0-rc.2", "bootstrap": "^3.3.7", "core-js": "^2.4.1", "firebase": "^4.4.0", "font-awesome": "^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" }, "devDependencies": { "@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", "jasmine-core": "~2.6.2", "jasmine-spec-reporter": "~4.1.0", "karma": "~1.7.0", "karma-chrome-launcher": "~2.1.1", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "ts-node": "~3.2.0", "tslint": "~5.3.2", "typescript": "~2.3.3" } }

Thanks

Answers

When you see Error Unknown compiler option 'files' for TypeScript project, it is most likely that your tsconfig.json is incorrect.

You probably have:

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

Rather than:

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

Related