【发布时间】:2016-06-20 17:54:18
【问题描述】:
我正在尝试在本地电脑上从 WAMP 运行 Angular2 应用程序。
我从 wamp/www 文件夹开发应用程序,并在 localhost:3000 和 localhost/myapp(liteserver 和 wamp)的不同阶段对其进行测试
一切正常,直到我尝试将 <base href="/"> 添加到 Index.html 正下方 <head>。
那时,只有在 Wamp 中我得到错误:ReferenceError: System is not defined
是否有任何解决方法或修复方法可以解决此错误? (并移至下一个:))
这是我的 Index.html。
<html>
<head>
<base href="/">
<title>Firebase</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<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>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.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>
<my-app>Loading...</my-app>
</body>
</html>
更新:
LiteServer 工作、文件夹结构和 main.ts:
【问题讨论】:
-
试试这个:document.write('
'); -
你能发布你的目录结构吗?
-
如果 System.js 已加载并包含,您能否检查您的浏览器控制台?
-
更新了帖子。在我将
<base href="/">添加到Index.html之后,看起来大多数文件都给出了 404,但不知道为什么。