找不到在Visual Studio 2015年更新模块'angular2 /核心“1 [英] Cannot find module 'angular2/core' in Visual Studio 2015 Update 1

查看:934
本文介绍了找不到在Visual Studio 2015年更新模块'angular2 /核心“1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰到这个错误的找不到模块'angular2 /核心尝试在 angular2公测时版本的Visual Studio 2015更新1 来了

在code是如下:

 进口从angular2 /芯{}组件@零件({
    选择:我的应用,
    模板:'< H1>我的第一角2应用< / H1>'
})
出口类AppComponent {
}

我有 angular2测试版的版本在我的 Visual Studio的ASP.NET 5 的项目。我曾经也使建设项目时编译TS文件。

这是我尝试过,但没有工作几件事情:


  1. 我加入 ///<参考路径=../ node_modules / angular2 / core.d.ts/> 在的顶部的 TS 文件。

2

 进口{}组件从angular2 /包/ angular2@零件({
    选择:我的应用,
    模板:'< H1>我的第一角2应用< / H1>'
})
出口类AppComponent {
}

3。

 进口从../node_modules/angular2/core{}组件@零件({
    选择:我的应用,
    模板:< H1>我的第一角2应用< / H1>中
})
出口类AppComponent {
}

更新:

这是我的tsconfig.json

  {
  compilerOptions:{
    noImplicitAny:假的,
    noEmitOnError:真实,
    removeComments:真实,
    sourceMap:真实,
    目标:ES6
    模块:系统
    emitDecoratorMetadata:真实,
    experimentalDecorators:真
  },
  排除:[
    node_modules
    wwwroot的
    bower_components
  ]
}

更新:

我添加的moduleResolution:节点 tsconfig.json 文件,但现在我得到另一套错误的:


  

1> ------重建全部开始:项目:Terminal.Web,配置:
  调试任何CPU ------
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(6,14):
  错误TS2300:构建:重复标识符PROPERTYKEY。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(9,5):
  错误TS2300:构建:复制标识完成。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(10,5):
  错误TS2300:构建:重复标识符价值。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(248,5):
  错误TS2300:构建:重复标识符EPSILON。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(283,5):
  错误TS2300:构建:重复标识符MAX_SAFE_INTEGER。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(290,5):
  错误TS2300:构建:复制标识MIN_SAFE_INTEGER。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(346,5):
  错误TS2300:构建:复制标识'标志'。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(498,5):
  错误TS2300:构建:重复标识符原型。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(561,5):
  错误TS2300:构建:复制标识'大小'。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(570,5):
  错误TS2300:构建:重复标识符原型。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(581,5):
  错误TS2300:构建:复制标识'大小'。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(590,5):
  错误TS2300:构建:重复标识符原型。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(605,5):
  错误TS2300:构建:重复标识符原型。
  1> C:\\测试\\ node_modules \\ angular2 \\分型\\ ES6-垫片\\ ES6-shim.d.ts(619,5):
  错误TS2300:构建:重复标识符原型。 1> C:\\ PROGRAM
  文件(x86)\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(3841,14):错误
  TS2300:构建:重复标识符PROPERTYKEY。 1> C:\\ Program Files文件
  (x86)的\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4061,5):错误
  TS2300:构建:重复标识符EPSILON。 1> C:\\ Program Files文件
  (x86)的\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4096,5):错误
  TS2300:构建:重复标识符MAX_SAFE_INTEGER。 1> C:\\ PROGRAM
  文件(x86)\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4103,5):错误
  TS2300:构建:复制标识MIN_SAFE_INTEGER。 1> C:\\ PROGRAM
  文件(x86)\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4389,5):错误
  TS2300:构建:复制标识完成。 1> C:\\ Program Files文件
  (x86)的\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4390,5):错误
  TS2300:构建:重复标识符价值。 1> C:\\ Program Files文件
  (x86)的\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4619,5):错误
  TS2300:构建:复制标识'标志'。 1> C:\\ Program Files文件
  (x86)的\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4647,5):错误
  TS2300:构建:复制标识'大小'。 1> C:\\ Program Files文件
  (x86)的\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4657,5):错误
  TS2300:构建:重复标识符原型。 1> C:\\ Program Files文件
  (x86)的\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4674,5):错误
  TS2300:构建:重复标识符原型。 1> C:\\ Program Files文件
  (x86)的\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4686,5):错误
  TS2300:构建:复制标识'大小'。 1> C:\\ Program Files文件
  (x86)的\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4696,5):错误
  TS2300:构建:重复标识符原型。 1> C:\\ Program Files文件
  (x86)的\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(4712,5):错误
  TS2300:构建:重复标识符原型。 1> C:\\ Program Files文件
  (x86)的\\微软的SDK \\打字稿\\ 1.7 \\ lib.es6.d.ts(5099,5):错误
  TS2300:构建:重复标识符原型。
  ==========全部重新生成:0成功,1失败,0已跳过==========



解决方案

下找到你的分型文件夹并拖动文件browser.d.ts到app.ts或项目中的任何TS文件。
你会得到///参考XXXX,一些错误应该被解决。

I came across this error Cannot find module 'angular2/core' when trying out the angular2 beta version in Visual Studio 2015 Update 1.

The code is below:

import {Component} from "angular2/core"

@Component({
    selector: 'my-app',
    template: '<h1>My First Angular 2 App</h1>'
})
export class AppComponent {
}

I have the angular2 beta version in my Visual Studio ASP.NET 5 project. I have also enabled compile TS files when building the project.

A few things that I tried, but none worked:

  1. I added /// <reference path="../node_modules/angular2/core.d.ts" /> at the top of the ts file.

2.

import {Component} from "angular2/bundles/angular2"

@Component({
    selector: 'my-app',
    template: '<h1>My First Angular 2 App</h1>'
})
export class AppComponent {
}

3.

import {Component} from "../node_modules/angular2/core"

@Component({
    selector: 'my-app',
    template: "<h1>My First Angular 2 App</h1>"
})
export class AppComponent {
}

UPDATE:

This is my tsconfig.json

{
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": true,
    "sourceMap": true,
    "target": "es6",
    "module": "system",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  },
  "exclude": [
    "node_modules",
    "wwwroot",
    "bower_components"
  ]
}

UPDATE:

I added "moduleResolution": "node" to tsconfig.json file, but now I get another set of errors:

1>------ Rebuild All started: Project: Terminal.Web, Configuration: Debug Any CPU ------ 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(6,14): error TS2300: Build: Duplicate identifier 'PropertyKey'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(9,5): error TS2300: Build: Duplicate identifier 'done'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(10,5): error TS2300: Build: Duplicate identifier 'value'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(248,5): error TS2300: Build: Duplicate identifier 'EPSILON'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(283,5): error TS2300: Build: Duplicate identifier 'MAX_SAFE_INTEGER'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(290,5): error TS2300: Build: Duplicate identifier 'MIN_SAFE_INTEGER'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(346,5): error TS2300: Build: Duplicate identifier 'flags'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(498,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(561,5): error TS2300: Build: Duplicate identifier 'size'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(570,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(581,5): error TS2300: Build: Duplicate identifier 'size'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(590,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(605,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Test\node_modules\angular2\typings\es6-shim\es6-shim.d.ts(619,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(3841,14): error TS2300: Build: Duplicate identifier 'PropertyKey'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4061,5): error TS2300: Build: Duplicate identifier 'EPSILON'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4096,5): error TS2300: Build: Duplicate identifier 'MAX_SAFE_INTEGER'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4103,5): error TS2300: Build: Duplicate identifier 'MIN_SAFE_INTEGER'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4389,5): error TS2300: Build: Duplicate identifier 'done'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4390,5): error TS2300: Build: Duplicate identifier 'value'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4619,5): error TS2300: Build: Duplicate identifier 'flags'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4647,5): error TS2300: Build: Duplicate identifier 'size'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4657,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4674,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4686,5): error TS2300: Build: Duplicate identifier 'size'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4696,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(4712,5): error TS2300: Build: Duplicate identifier 'prototype'. 1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7\lib.es6.d.ts(5099,5): error TS2300: Build: Duplicate identifier 'prototype'. ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

解决方案

find the browser.d.ts file under your typings folder and drag into your app.ts or any ts file in your project. you will get the ///reference xxxx, some error should be resolved

这篇关于找不到在Visual Studio 2015年更新模块'angular2 /核心“1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆