2016-09-26 89 views
0

从角度2快速启动项目后,我刚安装了打字稿的集合那样:错误:XHR错误(404未找到)安装打字稿收集与角2最终

npm install typescript-collections --save 

我确实有启动我的项目后出现以下错误。

GET http://localhost:63342/IMA%20Sentinel/node_modules/typescript-collections 404 (Not Found) 
Error: Error: XHR error (404 Not Found) loading http://localhost:63342/IMA%20Sentinel/node_modules/typescript-collections 
     at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:63342/IMA%20Sentinel/node_modules/zone.js/dist/zone.js:636:29) 
     at ZoneDelegate.invokeTask (http://localhost:63342/IMA%20Sentinel/node_modules/zone.js/dist/zone.js:225:37) 
     at Zone.runTask (http://localhost:63342/IMA%20Sentinel/node_modules/zone.js/dist/zone.js:125:47) 
     at XMLHttpRequest.ZoneTask.invoke (http://localhost:63342/IMA%20Sentinel/node_modules/zone.js/dist/zone.js:293:33) 
    Error loading http://localhost:63342/IMA%20Sentinel/node_modules/typescript-collections as "typescript-collections" from http://localhost:63342/IMA%20Sentinel/app/history.service.js 

这里是history.service.ts文件,我使用字典

import { Injectable } from '@angular/core'; 
import { Dto } from './dto'; 
import Collections = require('typescript-collections'); 

@Injectable() 
export class HistoryService { 

    public managedDtoDico : Collections.Dictionary<number, Dto> = new Collections.Dictionary<number, Dto>(); 

包在这里安装: [项目] \ node_modules \打字稿的集合

我tsconfig .json:

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "removeComments": false, 
    "noImplicitAny": true, 
    "suppressImplicitAnyIndexErrors": true 
    } 
} 

我错过了什么吗?

更新:这里是systemjs.config.js:

/** 
* System configuration for Angular 2 samples 
* Adjust as necessary for your application needs. 
*/ 
(function (global) { 
    System.config({ 
    paths: { 
     // paths serve as alias 
     'npm:': 'node_modules/' 
    }, 
    // map tells the System loader where to look for things 
    map: { 
     // our app is within the app folder 
     app: 'app', 

     // angular bundles 
     '@angular/core': 'npm:@angular/core/bundles/core.umd.js', 
     '@angular/common': 'npm:@angular/common/bundles/common.umd.js', 
     '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', 
     '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', 
     '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', 
     '@angular/http': 'npm:@angular/http/bundles/http.umd.js', 
     '@angular/router': 'npm:@angular/router/bundles/router.umd.js', 
     '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', 

     // other libraries 
     'rxjs':      'npm:rxjs', 
     'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api', 
     'typescript-collections': 'npm:typescript-collections' 
    }, 
    // packages tells the System loader how to load when no filename and/or no extension 
    packages: { 
     app: { 
     main: './main.js', 
     defaultExtension: 'js' 
     }, 
     rxjs: { 
     defaultExtension: 'js' 
     }, 
     'angular2-in-memory-web-api': { 
     main: './index.js', 
     defaultExtension: 'js' 
     } 
    } 
    }); 
})(this); 
+1

可以请你分享你的systemjs.config.js吗? – Sanket

回答

0

好吧,我知道了,这里是什么在system.config.js丢失:

, 
    'typescript-collections': { 
    main: './dist/lib/index.js', 
    defaultExtension: 'js' 
    } 

现在,它的工作原理。