我使用asp.net core,typescript和angular2来构建网站。 IDE是Visual Studio 2015 Update3。
问题:
错误讯息:
无法找到模块' @ angular / core'
对装饰器的实验支持是一个在将来的版本中可能会发生变化的功能。设置'experimentalDecorators'删除此警告的选项。
但项目仍然可以成功建立。
我有两个使用相同代码结构的项目,这个问题只发生在一个项目中。
有什么想法吗?谢谢!
tsconfig.json
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"noEmitOnError": false,
"noImplicitAny": false,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"moduleResolution": "node"
},
"exclude": [
"wwwroot",
"node_modules"
//"typings/index.d.ts"
],
"compileOnSave": true
}
的package.json
{
"version": "1.0.1",
"name": "asp.net",
"private": true,
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/forms": "0.2.0",
"@angular/http": "2.0.0-rc.4",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/router": "3.0.0-beta.1",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.4",
"angular2-in-memory-web-api": "0.0.14",
"reflect-metadata": "^0.1.3",
"core-js": "^2.4.0",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.27",
"zone.js": "^0.6.12"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-clean": "0.3.2",
"gulp-jshint": "2.0.1",
"gulp-uglify": "1.5.4",
"gulp-uglifycss": "1.0.6",
"gulp-concat": "^2.6.0",
"gulp-rename": "^1.2.2",
"jshint": "2.9.2",
"jshint-stylish": "2.2.0",
"pump": "1.0.1"
}
}
更新
我将相同的代码复制到新项目中。一切正常。
项目如何识别变量@angular并知道应该找到哪个文件夹?
更新:
我解决了这个问题,但我不知道为什么。 有一个名为' src'的文件夹。在' project / bin'夹。 src文件夹包含一些DLL文件。无法删除DLL文件,因为" 源文件名大于文件系统支持的文件名" ,更改名称后删除文件夹src。这个问题已修复。