Asp.net visual studio 2015中未识别类型脚本编译器选项
我使用Visual Studio 2015创建了一个ASP.NET 5空网站项目。 我使用以下内容设置了一个tsconfig.json文件:Asp.net visual studio 2015中未识别类型脚本编译器选项,asp.net,npm,typescript,visual-studio-2015,asp.net-core,Asp.net,Npm,Typescript,Visual Studio 2015,Asp.net Core,我使用Visual Studio 2015创建了一个ASP.NET 5空网站项目。 我使用以下内容设置了一个tsconfig.json文件: { "compilerOptions": { "noImplicitAny": false, "noEmitOnError": true, "removeComments": false, "sourceMap": true, "target": "es5",
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"module": "system",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"exclude": [
"node_modules",
"wwwroot"
]
}
{
"version": "1.0.0",
"name": "ASP.NET",
"private": true,
"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.0",
"systemjs": "0.19.6",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"zone.js": "0.5.10"
},
"devDependencies": {
"gulp": "3.8.11",
"gulp-concat": "2.5.2",
"gulp-cssmin": "0.1.7",
"gulp-uglify": "1.2.0",
"rimraf": "2.2.8"
}
}
Error TS1219 Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.
Error TS2307 Cannot find module 'angular2/core'.
Error TS1148 Cannot compile modules unless the '--module' flag is provided.
我已使用以下内容设置了我的package.json:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"module": "system",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"exclude": [
"node_modules",
"wwwroot"
]
}
{
"version": "1.0.0",
"name": "ASP.NET",
"private": true,
"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.0",
"systemjs": "0.19.6",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"zone.js": "0.5.10"
},
"devDependencies": {
"gulp": "3.8.11",
"gulp-concat": "2.5.2",
"gulp-cssmin": "0.1.7",
"gulp-uglify": "1.2.0",
"rimraf": "2.2.8"
}
}
Error TS1219 Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.
Error TS2307 Cannot find module 'angular2/core'.
Error TS1148 Cannot compile modules unless the '--module' flag is provided.
但是,当我创建此测试页面并尝试编译时,我被告知:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"module": "system",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"exclude": [
"node_modules",
"wwwroot"
]
}
{
"version": "1.0.0",
"name": "ASP.NET",
"private": true,
"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.0",
"systemjs": "0.19.6",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"zone.js": "0.5.10"
},
"devDependencies": {
"gulp": "3.8.11",
"gulp-concat": "2.5.2",
"gulp-cssmin": "0.1.7",
"gulp-uglify": "1.2.0",
"rimraf": "2.2.8"
}
}
Error TS1219 Experimental support for decorators is a feature that is subject to change in a future release. Specify '--experimentalDecorators' to remove this warning.
Error TS2307 Cannot find module 'angular2/core'.
Error TS1148 Cannot compile modules unless the '--module' flag is provided.
即使它是在我的tsconfig.json中配置的。有什么想法吗?Anuraj引导我找到了答案,我查看时的文档说要将其放在/scripts文件夹中,但这也不起作用
将tsconfig.json放入wwwroot文件夹是有效的。至少在我使用的版本的大部分时间 typescript存储库中有一个问题-谢谢,这导致了答案。你应该发帖,这样我才能给你信用。我将我的tsconfig.json移到了wwwroot站点的根目录中,并修复了它。以前它位于项目文件的根目录中。我试着把它放在一个脚本文件夹中,就像链接中建议的那样,但没有成功。把它放到wwwroot里行得通。看看。那不行,把它放到scripts文件夹里。必须将其放入wwwroot才能生效。