roo*_*ood 100 json typescript visual-studio-2015 asp.net-core
我有一个ASP.NET核心项目,当我尝试构建它时,我收到此错误:
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.
Run Code Online (Sandbox Code Playgroud)
这是我的tsconfig.json档案:
{
"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/*"
]
}
Run Code Online (Sandbox Code Playgroud)
这是一个错误还是我做错了什么?我最近升级Visual Studio 2015更新3.有没有人遇到过这个?
roo*_*ood 195
将空打字稿文件添加到typescript脚本文件夹(tsconfig文件的位置)以满足typescript编译器.
Fro*_*Dog 105
这可能是因为打字稿服务器找不到include数组描述的任何文件:
// tsconfig.json
{
//...
"include": [
"./src/"
],
}
Run Code Online (Sandbox Code Playgroud)
如果您使用的是 VSCode,则可以在编辑器中轻松重启 TS 服务器,以提示它重新评估文件,如下所示:
小智 19
在现代打字稿配置中,只需设置“allowJs”,无需在包含目录中添加任何空.ts文件,例如“src”(在包含数组中指定)
tsconfig.json
{
"compilerOptions": {
"allowJs": true,
...
},
"include": [
"src"
]
}
Run Code Online (Sandbox Code Playgroud)
Tre*_*eaf 13
我根本不在这个项目中使用TypeScript,因此处理这个问题非常令人沮丧.我通过将tsconfig.json和一个空的file.ts文件添加到项目根目录来修复此问题.tsconfig.json包含:
{
"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" ]
}
Run Code Online (Sandbox Code Playgroud)
Pra*_*kar 10
当您通过创建tsconfig.json文件时tsc --init,它会注释输入和输出文件目录。所以这是错误的根本原因。
要解决此问题,请取消注释这两行:
"outDir": "./",
"rootDir": "./",
Run Code Online (Sandbox Code Playgroud)
最初它在取消注释后看起来像上面一样。
但是我所有的 .ts 脚本都在 src 文件夹中。所以我指定了/src。
"outDir": "./scripts",
"rootDir": "./src",
Run Code Online (Sandbox Code Playgroud)
请注意,您需要在 rootDir 中指定 .ts 脚本的位置。
您也可以尝试重新启动代码编辑器。那也很好。
对我有用的解决方案是在配置文件中的每个包含路径之前添加一个 ./ :
"include": ["./src/**/*.d.ts", "./src/**/*.js", "./src/**/*.svelte"]
Run Code Online (Sandbox Code Playgroud)
我的所有 .ts 文件都在一个src文件夹中,该文件夹是我的 .ts 文件的同级文件夹tsconfig.json。当我include看起来像这样时,我收到了这个错误(它之前工作,一些依赖升级导致错误显示):
"include": [
"src/**/*"
],
Run Code Online (Sandbox Code Playgroud)
将其更改为此为我解决了问题:
"include": [
"**/*"
],
Run Code Online (Sandbox Code Playgroud)
改变index.js以index.ts修复这个错误我。(.ts在此之前我没有任何文件)。
注:记得随时随地改变你引用index.js到index.ts当然除了,在那里你引用您的主文件。按照惯例,这可能在您的lib或dist文件夹中。我的tsconfig.json:
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"outDir": "./dist",
"strict": true,
"esModuleInterop": true,
"inlineSourceMap": true,
"noImplicitAny": false
}
}
Run Code Online (Sandbox Code Playgroud)
我outDir是./dist所以我在 package.json 中引用我的 main 作为"main": "dist/index.js"
"outDir"
Run Code Online (Sandbox Code Playgroud)
应该不同于
"rootDir"
Run Code Online (Sandbox Code Playgroud)
例子
"outDir": "./dist",
"rootDir": "./src",
Run Code Online (Sandbox Code Playgroud)
小智 5
我收到此错误,“在配置文件'tsconfig.json'中未找到任何输入。指定的'包含'路径为'["**/*"]','排除'路径为'["**/*.spec.ts","app_/**/*.ts","**/*.d.ts","node_modules"]'。
我有一个.tsconfig文件,该文件从“ ./src”文件夹中读取ts文件。
这里的问题是该源文件夹不包含.ts文件,并且我正在运行tslint。我通过从gulp文件中删除tslint任务解决了问题。由于我没有任何.ts文件要编译和掉毛。这样做可以解决我的问题。
我在根目录( 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
}
}
Run Code Online (Sandbox Code Playgroud)