SystemJS无法正常工作

时间:2017-08-29 18:19:28

标签: node.js angular typescript systemjs

我正在为angular2 +社区创建一个公共扩展,并且演示不会像预期的那样运行,也许我做错了,错误是:

Fetch error: 404 Not Found
Instantiating http://localhost:3000/typescript
Loading typescript
Unable to load transpiler to transpile http://localhost:3000/demo/main.ts
Instantiating http://localhost:3000/demo/main.ts
Loading demo
at system.js:4
at ZoneDelegate.invoke (zone.js:392)
at Zone.run (zone.js:142)
at zone.js:844
at ZoneDelegate.invokeTask (zone.js:425)
at Zone.runTask (zone.js:192)
at drainMicroTaskQueue (zone.js:602)
at <anonymous>

花些时间查看Github上的代码,我更新了问题,以便有人可以帮助我吗?

感谢您的时间。

2 个答案:

答案 0 :(得分:0)

您可能有多行注释,在该注释中,您可能有一个import-statement

比较一下:https://github.com/angular/angular/issues/12967

length(b) > 0

System.JS使用正则表达式查找import-statements,因此即使在注释掉的代码块中也会找到它们

要解决此问题,请使用行注释

注释掉每个import语句
/*  import { CrisisListComponent }  from './crisis-list.component';
    import { HeroListComponent }    from './hero-list.component';    */

除此之外,你可能想谷歌 “无法加载转换器以转换”,因为这是问题的根本原因

答案 1 :(得分:0)

想出来,问题在于打字稿地图,我添加了一个手动的typescript.js映射,如下面的核心所描述的,它不会再给出任何错误,谢谢你的时间。

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/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/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
    '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
    // other libraries
    'rxjs': 'npm:rxjs',
    'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',

    'typescript': 'npm:typescript/lib/typescript.js'
},