angular2 - 设置错误为“未捕获的ReferenceError:系统未定义”

时间:2016-03-12 07:20:55

标签: angular systemjs

我正在尝试使用我的本地系统设置angular2应用。不使用任何feeds。但是我收到错误Uncaught ReferenceError: System is not defined - 但systemjs文件夹在那里,是否在我的moulde文件夹中。

我的设置有什么问题?

这是我的html文件:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>A2-App</title>
    <link rel="stylesheet" href="styles/global.css">
</head>
<body>
    <hello-app>Loading...</hello-app>
</body>
<!-- ES6-related imports -->
<script src="js/node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="js/node_modules/es6-shim/es6-shim.js"></script>
<script src="js/node_modules/systemjs/dist/system.js"></script>//file exist there, but getting 404
<script>
    //configure system loader
    System.config({defaultJSExtensions: true});
</script>
<script src="js/node_modules/rxjs/bundles/Rx.js"></script>
<script src="js/node_modules/angular2/bundles/angular2.min.js"></script>
<script>
    //bootstrap the Angular2 application
    System.import('dist/app').catch(console.log.bind(console));
</script>
</html>

1 个答案:

答案 0 :(得分:3)

我认为问题来自您使用的SystemJS版本。以下是版本:

  • angular2 beta9
  • systemjs 0.19.24

并以这种方式包含它:

<script src="node_modules/systemjs/dist/system.src.js"></script>

有关详细信息,请参阅此页: