Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS CODE error S5057 cannot find a tsconfig.json file at the specified directory: '.'

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.

like image 429
Winnemucca Avatar asked Apr 25 '16 04:04

Winnemucca


2 Answers

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.

like image 167
meDev Avatar answered Sep 22 '22 22:09

meDev


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."

like image 24
Neurotransmitter Avatar answered Sep 22 '22 22:09

Neurotransmitter