I am following angular.io tutorial in order to learn angular2. I have followed its steps.
created
package.json
systemjs.config.js
tsconfig.ts
typings.json
files
creates 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);
and finally 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>
yet while using npm start
to start it the console just throws errors
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)
is there any build in server? Tutorial does not show any server set up . Why is this happening and how can i fix it?
thanks
答案 0 :(得分:0)
change folder name "app.components.ts" to "app.component.ts" and inside main.ts change "Appcomponent" to "AppComponent". it should be written CamelCase