Strange Angular 2 / JS错误:“不能使用关键字'catch'作为标识符”?

时间:2017-02-13 05:42:20

标签: angularjs typescript

自学Angular 2。

一切都很好,突然出现这个错误:

Multiple Annotations found at this line:
  -Cannot use keyword 'import' as Identifier
  -Cannot use keyword 'catch' as Identifier. 

这是对违规行的屏幕抓取:

https://hub.docker.com/r/microsoft/dotnet/


现在,这个HTML页面在浏览器中加载了空白。 (好吧,它不是完全空白:它确实显示我正在尝试打开的.html文件的 名称 - 该名称显示为此网页上的唯一内容 - 就是这样。页面只是白色背景。

有什么线索在这里发生了什么?
(注意发生错误的这段代码甚至不是我的代码;它随文件附带的模板代码。正如我已经提到的,所有 完美地工作很好 - 直到这个错误突然出现了......)

非常感谢任何帮助!

==========================

更新 - 添加完整的HTML文件和systemjs.config.js文件 - 我甚至没有触及过:

/**
 * System configuration for Angular 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',
      'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
    },
    // 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'
      },
      'angular-in-memory-web-api': {
        main: './index.js',
        defaultExtension: 'js'
      }
    }
  });
})(this);

这是完整的HTML文档:

<html>
  <head>
    <title>Angular 2 Demo</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="styles.css">
    <!-- 1. Load libraries -->
     <!-- Polyfill(s) for older browsers -->
    <script src="node_modules/core-js/client/shim.min.js"></script>
    <script src="node_modules/zone.js/dist/zone.js"></script>
    <script src="node_modules/reflect-metadata/Reflect.js"></script>
    <script src="node_modules/systemjs/dist/system.src.js"></script>

    <!-- 2. Configure SystemJS -->
    <script src="systemjs.config.js"></script>
    <script>System.import('app').catch(function(err) { console.error(err); });
    </script>
  </head>

  <!-- 3. Display the application -->
  <body>
    <subscription-form></subscription-form>
  </body>

</html>

0 个答案:

没有答案