角度升级指南。 (SystemJS)意外的令牌<

时间:2017-02-12 09:13:45

标签: angularjs angular upgrade systemjs

大家。 我正在尝试将角度为1的大型应用升级为角度2.首先,它尝试使用official guide创建混合角1/2应用。

当所有说明完成后,我收到错误

Unhandled Promise rejection: (SystemJS) Unexpected token <
SyntaxError: Unexpected token <
    at eval (<anonymous>)
    at ZoneDelegate.invoke (http://localhost:8000/node_modules/zone.js/dist/zone.js:242:26)
    at Zone.run (http://localhost:8000/node_modules/zone.js/dist/zone.js:113:43)
    at http://localhost:8000/node_modules/zone.js/dist/zone.js:535:57
    at ZoneDelegate.invokeTask (http://localhost:8000/node_modules/zone.js/dist/zone.js:275:35)
    at Zone.runTask (http://localhost:8000/node_modules/zone.js/dist/zone.js:151:47)
    at drainMicroTaskQueue (http://localhost:8000/node_modules/zone.js/dist/zone.js:433:35)
    at XMLHttpRequest.ZoneTask.invoke (http://localhost:8000/node_modules/zone.js/dist/zone.js:349:25)
Evaluating http://localhost:8000/app
Error loading http://localhost:8000/app ; Zone: <root> ; Task: Promise.then ; Value: 

我的systemjs.config.js

(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',
      '@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',

      // other libraries
      'rxjs':                      'npm:rxjs',
      'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        defaultExtension: 'js'
      },
      rxjs: {
        defaultExtension: 'js'
      }
    }
  });
})(this);

我在[{1}}

中的依赖关系
package.config

有人可以帮我这个吗?

1 个答案:

答案 0 :(得分:0)

您应该通过添加应用的主入口点来解决此问题。

Top