2016-08-26 2 views
3

so folgte ich this tutorial und am Ende bekam ich diesen FehlerAngular 2 in Laravel nicht funktioniert

system.src.js:1049 GET http://localhost:8000/boot.js 404 (Not Found)

es ist mein gulpfile:

const elixir = require('laravel-elixir'); 

var elixirTypscript = require('elixir-typescript'); 

elixir(function(mix) { 
    mix.sass('app.scss'); 

mix.copy('node_modules/angular2', 'public/angular2'); 
mix.copy('node_modules/rxjs', 'public/rxjs'); 
mix.copy('node_modules/systemjs', 'public/systemjs'); 
mix.copy('node_modules/es6-promise', 'public/es6-promise'); 
mix.copy('node_modules/es6-shim', 'public/es6-shim'); 
mix.copy('node_modules/zone.js', 'public/zone.js'); 

mix.typescript(
    [ 
     'app.component.ts', 
     'boot.ts' 
    ], 
    'public/', 
    { 
     "target": "es5", 
     "module": "system", 
     "moduleResolution": "node", 
     "sourceMap": true, 
     "emitDecoratorMetadata": true, 
     "experimentalDecorators": true, 
     "removeComments": false, 
     "noImplicitAny": false 
    } 
); 

}); 

es ist mein app.component.ts :

import {Component} from 'angular2/core'; 

@Component({ 
    selector: 'my-app', 
    template: `<h1>My First Angular 2 App</h1>` 
}) 
export class AppComponent { } 

und es ist mein Boot:

///<reference path="../../../node_modules/angular2/typings/browser.d.ts"/> 

import {bootstrap} from 'angular2/platform/browser' 
import {AppComponent} from './app.component' 

bootstrap(AppComponent); 

und es ist schließlich meine Klinge Ansicht ich diese Zeilen in Kopf-Tag platziert, wenn es darauf ankommt, (ich weiß nicht mehr wirklich ...)

<script src="es6-shim/es6-shim.min.js"></script> 
    <script src="systemjs/dist/system-polyfills.js"></script> 
    <script src="angular2/es6/dev/src/testing/shims_for_IE.js"></script> 
    <script src="angular2/bundles/angular2-polyfills.js"></script> 
    <script src="systemjs/dist/system.src.js"></script> 
    <script src="rxjs/bundles/Rx.js"></script> 
    <script src="angular2/bundles/angular2.dev.js"></script> 
    <script> 
     System.config({ 
      "defaultJSExtensions": true, 
      packages: { 
       app: { 
        format: 'register', 
        defaultExtension: 'js' 
       } 
      } 
     }); 

     System.import('boot') 
       .then(nPull, console.error.bind(console)); 
    </script> 
+0

In Ihrer Schluckdatei ändern Sie 'public' zu 'public/boot.js' – tam5

+0

@tam hat nicht funktioniert :( – MohammadrezA

+0

Kennen Sie sich mit Typescript aus, oder verwenden Sie es einfach nur, weil das Tutorial so aussagt? – Ohgodwhy

Antwort

0

Stellen Sie sicher, Ihre Dateien .ts ist in " Ressourcen/Assets/Typescript/"und Ihr Aufruf auf der Seite haben den vollständigen Pfad wie" app/typescript /.

nach Aufruf Gulp wird es "app/Typoskript /" mit den Dateien in Ihrem erstellen "Ressourcen/assets/Typoskript /"

System.import('app/typescript/boot').catch(console.log.bind(console)) 

auf meinem Setup funktioniert gut danach einstellt.

Verwandte Themen