Reputation: 2552
I'm trying to update my Angular4 application to Angular5.
I tryed to follow the procedure suggested by the official site but now I can't no more compile and I get this error:
error TS5023: Unknown compiler option 'compilerOptions'.
This is the version of the components:
Angular CLI: 1.6.8
Node: 7.4.0
OS: win32 x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router
@angular/cli: 1.6.8
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.7.1
webpack: 3.10.0
{
"compilerOptions": {
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
],
"types": [
"jquery",
"jqueryui",
"jasmine",
"datatables.net",
"datatables.net-select"
],
"compilerOptions": {
"types" : [ "node" ]
}
}
}
How can I fix it?
Thanks to support
Upvotes: 5
Views: 18757
Reputation: 5962
There is an error in your tsconfig.json format which is mentioned in the error message. You have one extra compilerOptions
property inside the original compilerOptions
object. it should be like below
{
"compilerOptions": {
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
],
"types": [
"jquery",
"jqueryui",
"jasmine",
"datatables.net",
"datatables.net-select"
]
}
}
However typeRoots
will be given preference instead of types
here and all packages will be loaded from "../node_modules/@types"
. Check this link for all the options .
https://www.typescriptlang.org/docs/handbook/compiler-options.html
http://www.typescriptlang.org/docs/handbook/tsconfig-json.html
Upvotes: 8