I am having fits getting visual studio code going with my angular 2 starter project.
I have set up my tsconfig.json like so ...
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
Immediately I came across this error
[ts] Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
class AppComponent
I could not identify what was going on so I ran a build and got this error.
error TS5057: Cannot find a tsconfig.json file at the specified directory: '.'
This error explains why I am getting errors about the component decorator, but I am not sure why the tsconfig.json file is not being found.
I only have one folder and it is holding everything except index.html, package.json and .gitignore.
I got similar error. Solved by changing following line in tasks.json
"args": ["-p", "."],
to
"args": ["-p", "./src"],
In my case tsconfig.json was was in src folder. The Angular 2 project was created using angular-cli.
For the most people on Visual Studio Code, it will be sufficient just to create tsconfig.json
file in the document root (that's probably where your .ts
files are) with simple contents: {}
.
This means "an empty JSON file <...>. This will be sufficient for most people."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With