JSPM _angular_core.OptionalMetadata不是构造函数

时间:2016-09-15 12:07:23

标签: angular jspm

我试图将我的angular2(RC5)应用程序与JSPM捆绑在一起。捆绑似乎没问题。但是当我尝试运行我的应用程序时,我得到了JS JS错误

"错误:(SystemJS)_angular_core.OptionalMetadata不是构造函数"

我的config.js看起来像这样:

/**
 * System configuration for Angular 2 samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  System.config({
    defaultJSExtensions: true,
    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',
      'ng2-translate': 'npm:ng2-translate',
      'ng2-bs3-modal': 'npm:ng2-bs3-modal',
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        main: './main.js',
        defaultExtension: 'js'
      },
      'angular2-in-memory-web-api': {
        main: './index.js',
        defaultExtension: 'js'
      }
    }
  });
})(this);

我的package.json看起来像这样

{
  "name": "productname",
  "version": "1.0.0",
  "scripts": {
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "lite": "lite-server",
    "start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common": "2.0.0-rc.6",
    "@angular/compiler": "2.0.0-rc.6",
    "@angular/compiler-cli": "0.6.0",
    "@angular/core": "2.0.0-rc.6",
    "@angular/forms": "2.0.0-rc.6",
    "@angular/http": "2.0.0-rc.6",
    "@angular/platform-browser": "2.0.0-rc.6",
    "@angular/platform-browser-dynamic": "2.0.0-rc.6",
    "@angular/router": "3.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.6",
    "angular2-in-memory-web-api": "0.0.18",
    "bootstrap": "^3.3.6",
    "core-js": "^2.4.1",
    "ng2-bs3-modal": "^0.7.0",
    "ng2-translate": "^2.4.3",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.11",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.17"
  },
  "devDependencies": {
    "concurrently": "^2.2.0",
    "jspm": "^0.16.45",
    "lite-server": "^2.2.2",
    "typescript": "^1.8.10",
    "typings": "^1.3.2"
  },
  "jspm": {
    "configFile": "config.jspm.js",
    "dependencies": {
      "@angular/core": "npm:@angular/core@2.0.0-rc.6",
      "@angular/common": "npm:@angular/common@2.0.0-rc.6",
      "@angular/compiler": "npm:@angular/compiler@2.0.0-rc.6",
      "@angular/compiler-cli": "npm:@angular/compiler-cli@0.6.0",      
      "@angular/forms": "npm:@angular/forms@2.0.0-rc.6",
      "@angular/http": "npm:@angular/http@2.0.0-rc.6",
      "@angular/platform-browser": "npm:@angular/platform-browser@2.0.0-rc.6",
      "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@2.0.0-rc.6",
      "@angular/router": "npm:@angular/router@3.0.0-rc.2",
      "@angular/upgrade": "npm:@angular/upgrade@2.0.0-rc.6",
      "core-js": "npm:core-js@^2.4.1",
      "ng2-bs3-modal": "npm:ng2-bs3-modal@^0.7.0",
      "ng2-translate": "npm:ng2-translate@^2.4.3",
      "reflect-metadata": "npm:reflect-metadata@^0.1.3",
      "rxjs": "npm:rxjs@5.0.0-beta.11",
      "zone.js": "npm:zone.js@^0.6.17"
    },
    "devDependencies": {
      "typescript": "npm:typescript@^1.8.10"
    }
  }
}

我用我的捆绑 " jspm捆绑app / main my_bundle.js"

有人知道如何解决这个问题吗?

0 个答案:

没有答案