首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Angular2服务器连接

Angular2服务器连接
EN

Stack Overflow用户
提问于 2016-07-12 05:08:24
回答 0查看 462关注 0票数 0

为了学习angular2,我正在学习angular.io教程。我已经跟随了它的脚步。

已创建

代码语言:javascript
复制
package.json
systemjs.config.js
tsconfig.ts
typings.json

文件

创建app.components.ts

代码语言:javascript
复制
import { component } from '@angular/core'
@Component({
    selector:'my-app',
    template:'<h1>My First Angular 2 App</h1>'
});

export class AppComponent{}

main.ts

代码语言:javascript
复制
import { bootstrap }    from '@angular/platform-browser-dynamic';
import { Appcomponent } from './app.components';

bootstrap(Appcomponent);

最后是index.html

代码语言:javascript
复制
<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启动它时,控制台只是抛出错误

代码语言:javascript
复制
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)

在服务器中有构建吗?教程不显示任何服务器设置。为什么会发生这种情况?我如何修复它?

谢谢

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38316257

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档