简体   繁体   English

Angular2构建:仅在Visual Studio中找不到名称“ Promise”

[英]Angular2 Build: Cannot find name 'Promise' only in Visual Studio

I am getting started with Angular2 and followed the quickstart here: https://angular.io/guide/quickstart 我开始使用Angular2,并按照此处的快速入门进行操作: https ://angular.io/guide/quickstart

It seems to work fine when I do npm install but I want to run it in Visual Studio and I will be making in Asp.Net/C# and not NodeJS. 当我执行npm安装时,它似乎工作正常,但是我想在Visual Studio中运行它,而我将在Asp.Net/C#中而不是NodeJS中进行制作。

When I build the solution in VS I get this: 当我在VS中构建解决方案时,我得到了:

在此处输入图片说明

I think in nodejS it works because in the package.json we have this: 我认为它在nodejS中有效,因为在package.json中,我们有以下内容:

"postinstall": "typings install",

entire 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.2",
    "@angular/compiler": "2.0.0-rc.2",
    "@angular/core": "2.0.0-rc.2",
    "@angular/http": "2.0.0-rc.2",
    "@angular/platform-browser": "2.0.0-rc.2",
    "@angular/platform-browser-dynamic": "2.0.0-rc.2",
    "@angular/router": "2.0.0-rc.2",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.2",
    "systemjs": "0.19.27",
    "core-js": "^2.4.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "zone.js": "^0.6.12",
    "angular2-in-memory-web-api": "0.0.12",
    "bootstrap": "^3.3.6"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.10",
    "typings": "^1.0.4"
  }
}

But problem is I am using Visual studio. 但是问题是我正在使用Visual Studio。 How can I just build the solution and make it run without using npm start 如何不使用npm start可以构建解决方案并使它运行

I think you must use es6-shim to get these errors away. 我认为您必须使用es6-shim才能消除这些错误。 Try this: 尝试这个:

typings install dt~es6-shim --save --global

This fixed the problem for me. 这为我解决了问题。

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

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