tsconfig.json: Build:No inputs were found in config file

JsonTypescriptVisual Studio-2015asp.net Core

Json Problem Overview


I have an ASP.NET core project and I'm getting this error when I try to build it:

error TS18003: Build:No inputs were found in config file 'Z:/Projects/client/ZV/src/ZV/Scripts/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["../wwwroot/app","node_modules/*"]'.
1>         The command exited with code 1.
1>       Done executing task "VsTsc" -- FAILED.

This is my tsconfig.json file:

{
  "compileOnSave": true,
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es5", "dom" ],
    "module": "commonjs",
    "moduleResolution": "node",
    "noEmitOnError": true,
    "noImplicitAny": false,
    "outDir": "../wwwroot/app/",
    "removeComments": false,
    "sourceMap": true,
    "target": "es6"
  },
  "exclude": [
    "../wwwroot/app",
    "node_modules/*"
  ]
}

Is this a bug or am I doing something wrong? I did recently upgrade Visual Studio 2015 to update 3. Has anyone encountered this before?

Json Solutions


Solution 1 - Json

Add an empty typescript file to the typescript scripts folder (the location of your tsconfig file) to satisfy the typescript compiler.

Solution 2 - Json

You can also try to restart your code editor. That works well too.

Solution 3 - Json

This can occur because typescript server can't find any files described by the include array:

// tsconfig.json
{
  //...
  "include": [
    "./src/"
  ],
}

If you're using VSCode, you can restart your TS server within your editor super easily to prompt it to re-evaluate the file like this:

  1. Navigate to any .ts or .tsx file

  2. Open the command palette (CMD + SHIFT + P on mac)

  3. Run the TypeScript: Restart TS server command:

    TypeScript - Restart TS Server

Solution 4 - Json

I'm not using TypeScript in this project at all so it's quite frustrating having to deal with this. I fixed this by adding a tsconfig.json and an empty file.ts file to the project root. The tsconfig.json contains this:

{
  "compilerOptions": {

    "allowJs": false,
    "noEmit": true // Do not compile the JS (or TS) files in this project on build

  },
  "compileOnSave": false,
  "exclude": [ "src", "wwwroot" ],
  "include": [ "file.ts" ]
}

Solution 5 - Json

If you are using the vs code for editing then try restarting the editor.This scenario fixed my issue.I think it's the issue with editor cache.

Solution 6 - Json

When you create the tsconfig.json file by tsc --init, then it comments the input and output file directory. So this is the root cause of the error.

To get around the problem, uncomment these two lines:

"outDir": "./", 
"rootDir": "./", 

Initially it would look like above after un-commenting.

But all my .ts scripts were inside src folder. So I have specified /src.

"outDir": "./scripts", 
"rootDir": "./src", 

>Please note that you need to specify the location of your .ts scripts in rootDir.

Solution 7 - Json

I was getting this error:

> No inputs were found in config file 'tsconfig.json'.

Specified include paths were '["**/*"]' and exclude paths '["**/*.spec.ts","app_/**/*.ts","**/*.d.ts","node_modules"]'.

I had a .tsconfig file, which read TS files from the ./src folder.

The issue here was that with the source folder not containing any .ts files and I was running tslint. I resolved issue by removing tslint task from my gulp file, as I don't have any .ts files to be compiled and linted.

Solution 8 - Json

I have all of my .ts files inside a src folder that is a sibling of my tsconfig.json. I was getting this error when my include looked like this (it was working before, some dependency upgrade caused the error showing up):

"include": [
    "src/**/*"
],

changing it to this fixed the problem for me:

"include": [
    "**/*"
],

Solution 9 - Json

Changing index.js to index.ts fixed this error for me. (I did not have any .ts files before this).

Note: remember to change anywhere you reference index.js to index.ts except of course, where you reference your main file. By convention this is probably in your lib or dist folders. My tsconfig.json:

{
  "compilerOptions": {
    "target": "es2016",
    "module": "commonjs",
    "outDir": "./dist",
    "strict": true,
    "esModuleInterop": true,
    "inlineSourceMap": true,
    "noImplicitAny": false
  }
}

My outDir is ./dist so I reference my main in my package.json as "main": "dist/index.js"

enter image description here

Solution 10 - Json

"outDir"

Should be different from

"rootDir"

example

    "outDir": "./dist",
    "rootDir": "./src", 

Solution 11 - Json

In modern typescript config just set "allowJs" and no need to add any empty .ts file in include directories such as "src" (specified in include array)

tsconfig.json

{
  "compilerOptions": {
    "allowJs": true,
   ...
  },
  "include": [
    "src"
  ]
}

Solution 12 - Json

I added the following in the root ( visual studio )

{
  "compilerOptions": {
    "allowJs": true,
    "noEmit": true,
    "module": "system",
    "noImplicitAny": true,
    "removeComments": true,
    "preserveConstEnums": true,
    "sourceMap": true
  },
  "include": [
    "**/*"
  ],
  "exclude": [
    "assets",
    "node_modules",
    "bower_components",
    "jspm_packages"
  ],
  "typeAcquisition": {
    "enable": true
  }
}

Solution 13 - Json

You need to have the root index.tsx or index.ts file for the tsc command to work.

Solution 14 - Json

When using Visual Studio Code, building the project (i.e. pressing Ctrl + Shift + B), moves your .ts file into the .vscode folder (I don't know why it does this), then generates the TS18003 error. What I did was move my .ts file out of the .vscode folder, back into the root folder and build the project again.

The project built successfully!

Solution 15 - Json

add .ts file location in 'include' tag then compile work fine. ex.

"include": [
"wwwroot/**/*" ]

Solution 16 - Json

Ok, in 2021, with a <project>/src/index.ts file, the following worked for me:

> If VS Code complains with No inputs were found in config file... then change the include to…

"include": ["./src/**/*.ts"]

Found the above as a comment of How to Write Node.js Applications in Typescript

Solution 17 - Json

If you don't want TypeScript compilation, disable it in your .csproj file, according to this post.

Just add the following line to your .csproj file:

<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>

Solution 18 - Json

I had to add the files item to the tsconfig.json file, like so:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true,
    },
    "files": [
        "../MyFile.ts"
    ] 
}

More details here: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

Solution 19 - Json

My VSCode was giving me the squiggly line at the beginning of my tsconfig.json file, and had the same error, so

  1. I made sure I had at least one .ts file in the folder specified in the "include" paths (one of the folders in the include path was empty and it was fine)

  2. I simply closed the VSCode and opened it back up, and that fixed it. (sigh..)

My folder structure

    tsconfig.json
    package.json
    bar/
         myfile.ts
    lib/
         (no file)

My tsconfig.json

   "compilerOptions": { ... },
   "include": [
    "bar/**/*",
    "lib/**/*"
   ],
   "exclude": [
    ".webpack/**/*",
    ".vscode/**/*"
   ]
   

Solution 20 - Json

Btw, just had the same problem.

If you had my case, then you probably have the tsconfig.json not in the same directory as the .ts file.

(In my case I stupidly had next to launch.json and tasks.json inside the .vscode folder :P)

Solution 21 - Json

I had existing tsconfig files for 4 existing projects in my solution. After upgrading to vs2017 I experienced this problem. It was fixed by adding the (supposedly default) include and exclude sections to the files, as described by NicoJuicy.

Solution 22 - Json

For anyone experiencing the same error should try adding "node modules" to the exclude options

{
   "compilerOptions": {
     ...
   },
   "include": [
      "./src/**/*.ts"
   ],
   "exclude": [
      "./out.d.ts",
      "node_modules",
   ]
}

Solution 23 - Json

The solution that worked for me was to add a ./ before each include path in the config file:

"include": ["./src/**/*.d.ts", "./src/**/*.js", "./src/**/*.svelte"]

Solution 24 - Json

I have a tsconfig.json file that doesn't apply to any .ts files. It's in a separate folder. Instead I only use it as a base for other tsconfig files via "extends": "../Configs/tsconfig.json". As soon as I renamed the base config file to something else e.g. base-tsconfig.json (and updated the extends statements) the error went away and the extending still worked.

Solution 25 - Json

I got the same error and in my case it was because vscode couldn't recognize .ts file.

It was seeing it as text file and I had to rename it to remove one letter and add it back to make it work.

Solution 26 - Json

I ran into this issue constantly while packing my projects into nugets via Visual Studio 2019. After looking for a solution for ages I seem to have solved this by following advice in this article

MSBuild & Typescript

especially part about <TypeScriptCompile /> where I included all my .ts resources with the Include operator and excluded others such as node_modules with the Remove operator. I then deleted the tsconfig.json file in each offending project and the nuget packages were generated and no more errors

Solution 27 - Json

I received this same error when I made a backup copy of the node_modules folder in the same directory. I was in the process of trying to solve a different build error when this occurred. I hope this scenario helps someone. Remove the backup folder and the build will complete.

Solution 28 - Json

I had the same error because I had this:

"include": [ 
    "wwwroot/ts/*.ts" 
  ],
  "exclude": [ 
    "node_modules",
    "wwwroot"
  ]

The error appear because the folder wwwroot appear in include and exclude, you should quit one of them.

Solution 29 - Json

Make sure all your files has a correct name.

Solution 30 - Json

You need to have two folders, one for the source (typescript) and another for the output (javascript).

tsconfig.json:

{
  "compilerOptions": {
...
    "outDir": "out/", 
    "rootDir": "src/", 
...

Solution 31 - Json

If you are using VSCode, and you have several folders opened then you need to open the one folder you are working on for it to go away.

>Wrong Opening of Folder enter image description here >Right Opening of Folder enter image description here

Solution 32 - Json

I used that https://stackoverflow.com/questions/39176586/how-to-disable-typescript-compilation-in-net-core-projects

Because I use a template and those packages require for only my template. However I can see every packages' export in their node_module files. If you are in same situation you can use link above

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionroodView Question on Stackoverflow
Solution 1 - JsonroodView Answer on Stackoverflow
Solution 2 - JsondesogaView Answer on Stackoverflow
Solution 3 - JsonFrostyDogView Answer on Stackoverflow
Solution 4 - JsonTreeAndLeafView Answer on Stackoverflow
Solution 5 - JsonSusampathView Answer on Stackoverflow
Solution 6 - JsonPran Kumar SarkarView Answer on Stackoverflow
Solution 7 - JsonInukollu Hari krishnaView Answer on Stackoverflow
Solution 8 - JsonCorey ColeView Answer on Stackoverflow
Solution 9 - Jsonrose specsView Answer on Stackoverflow
Solution 10 - JsonFDiskView Answer on Stackoverflow
Solution 11 - JsonNikhil NayyarView Answer on Stackoverflow
Solution 12 - JsonNicoJuicyView Answer on Stackoverflow
Solution 13 - JsonGruView Answer on Stackoverflow
Solution 14 - Jsonuser3315406View Answer on Stackoverflow
Solution 15 - JsonRajat KumarView Answer on Stackoverflow
Solution 16 - JsonBig RichView Answer on Stackoverflow
Solution 17 - JsonRubbelDieKatzView Answer on Stackoverflow
Solution 18 - JsonCosminView Answer on Stackoverflow
Solution 19 - Jsonil0v3d0gView Answer on Stackoverflow
Solution 20 - JsonTha BradView Answer on Stackoverflow
Solution 21 - JsonElroy FlynnView Answer on Stackoverflow
Solution 22 - JsonSammyView Answer on Stackoverflow
Solution 23 - JsonMatt ParkinsView Answer on Stackoverflow
Solution 24 - Jsonuser764754View Answer on Stackoverflow
Solution 25 - JsonBakhtiiar MuzakparovView Answer on Stackoverflow
Solution 26 - JsonLaurence73View Answer on Stackoverflow
Solution 27 - JsonchadiusvtView Answer on Stackoverflow
Solution 28 - JsonMatias NovilloView Answer on Stackoverflow
Solution 29 - JsonMostafa SaadatniaView Answer on Stackoverflow
Solution 30 - JsondaniloView Answer on Stackoverflow
Solution 31 - JsonMichaelDHaileView Answer on Stackoverflow
Solution 32 - Jsonuser9399896View Answer on Stackoverflow