简体   繁体   English

Angular 2 RC.5&VS 2015:找不到名称'module','Set','Map','MapConstructor','SetConstructor'

[英]Angular 2 RC.5 & VS 2015: Cannot find name 'module', 'Set', 'Map', 'MapConstructor', 'SetConstructor'

The issue that I'm having is in the title. 我所拥有的问题在标题中。 Everything that I've read says that it's a typings issue, but I haven't been able to track it down yet. 我读过的所有内容都说它是一个打字问题,但我还没有能够追踪它。 It's a pretty large project, so I'll only give a few example of my settings: 这是一个非常大的项目,所以我只举几个例子来说明我的设置:

tsconfig.json tsconfig.json

{
  "compileOnSave": true,
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
"exclude": ["node_modules", "typings"]
}

typings.json typings.json

{
  "globalDependencies": {
    "core-js": "registry:dt/core-js#0.0.0+20160602141332",
    "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
    "node": "registry:dt/node#6.0.0+20160807145350"
  }
}

package.json 的package.json

{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "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.5",
    "@angular/compiler": "2.0.0-rc.5",
    "@angular/core": "2.0.0-rc.5",
    "@angular/compiler-cli": "0.5.0",
    "@angular/forms": "0.3.0",
    "@angular/http": "2.0.0-rc.5",
    "@angular/platform-browser": "2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "2.0.0-rc.5",
    "@angular/router": "3.0.0-rc.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.5",
    "angular2-in-memory-web-api": "0.0.17",
    "bootstrap": "^3.3.6",
    "core-js": "^2.4.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.12"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.10",
    "typings":"^1.3.3"
  }
}

Things I have tried: 我尝试过的事情:

  1. Referencing typings files directly in my app's entrypoint 直接在我的应用程序入口点引用打字文件
  2. Changing compilerOptions -> target to es6/es2015 更改compilerOptions - > target到es6 / es2015
  3. Uninstalling and reinstalling the typings references in the root 卸载并重新安装根目录中的typings引用
  4. Updating the typings.json to the most up-to-date versions 将typings.json更新为最新版本
  5. installing es6-shim and its typings 安装es6-shim及其打字

Any other suggestions would be much appreciated. 任何其他建议将不胜感激。

在此输入图像描述

Your package.json above has "typescript":"^1.8.10" , but if you've updated to 2.0.2 in the last day or two it could be this bug with Typescript. 你上面的package.json"typescript":"^1.8.10" ,但如果你在最后一两天更新到2.0.2 ,那么就是Typescript的错误 If so, downgrading to an earlier version should fix it. 如果是这样,降级到早期版本应该修复它。

Your error messages look very similar to those reported in this issue on the angular-cli project. 您的错误消息与angular-cli项目中此问题中报告的错误消息非常相似。

Almost forgot about this question... 差点忘了这个问题......

I resolved this by removing the nuget packages Typescript.Compiler and Typescript.MsBuild from the project. 我通过从项目中删除nuget包Typescript.Compiler和Typescript.MsBuild来解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM