为了学习angular2,我正在学习angular.io教程。我已经跟随了它的脚步。
已创建
package.json
systemjs.config.js
tsconfig.ts
typings.json文件
创建app.components.ts
import { component } from '@angular/core'
@Component({
selector:'my-app',
template:'<h1>My First Angular 2 App</h1>'
});
export class AppComponent{}main.ts
import { bootstrap } from '@angular/platform-browser-dynamic';
import { Appcomponent } from './app.components';
bootstrap(Appcomponent);最后是index.html
<html>
<head>
<title>Angular 2 QuickStart</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>
<my-app>Loading...</my-app>
</body>
</html>然而,当使用npm start启动它时,控制台只是抛出错误
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:3000/app/main.js Failed to load resource: the server responded with a status of 404 (Not Found)
localhost/:16 Error: Error: XHR error (404 Not Found) loading http://localhost:3000/app/main.js(…)(anonymous function) @ localhost/:16
3content.js:191 NO OEMBED
http://localhost:3000/styles.css Failed to load resource: the server responded with a status of 404 (Not Found)在服务器中有构建吗?教程不显示任何服务器设置。为什么会发生这种情况?我如何修复它?
谢谢
https://stackoverflow.com/questions/38316257
复制相似问题