Also muss ich einen Build erstellen, der funktionieren kann, ohne einen Server zu betreiben.Angular 2 ng Build
Führen Sie ng build
. Habe einen dist
Ordner.
Wenn ich laufe index.html
im erhalte eine Fehlermeldung wie
GET file:///D:/inline.bundle.js net::ERR_FILE_NOT_FOUND
Er sucht dass js
Datei in der Wurzel meines D: // Antrieb, nicht in einem Projektordner
So in Ordnung i entfernt, wobei ein <base href="/">
von meinem index.html
und bekam diesen Fehler:
Unhandled Promise rejection: No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document. ; Zone: <root> ; Task: Promise.then ; Value: ZoneAwareError {__zone_symbol__error: Error: No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to…, __zone_symbol__stack: "Error: No base href set. Please provide a value fo…testing1/dist/vendor.bundle.js:28631:62) [<root>]", __zone_symbol__message: "No base href set. Please provide a value for the A…HREF token or add a base element to the document."} Error: No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.
at new PathLocationStrategy (file:///D:/angular/testing1/dist/vendor.bundle.js:66150:19) [angular]
at provideLocationStrategy (file:///D:/angular/testing1/dist/vendor.bundle.js:62944:9) [angular]
at AppModuleInjector.get (/AppModule/module.ngfactory.js:164:77) [angular]
at AppModuleInjector.get (/AppModule/module.ngfactory.js:169:84) [angular]
at AppModuleInjector.get (/AppModule/module.ngfactory.js:198:151) [angular]
at AppModuleInjector.createInternal (/AppModule/module.ngfactory.js:241:60) [angular]
at AppModuleInjector.NgModuleInjector.create (file:///D:/angular/testing1/dist/vendor.bundle.js:56323:76) [angular]
at NgModuleFactory.create (file:///D:/angular/testing1/dist/vendor.bundle.js:56291:18) [angular]
at file:///D:/angular/testing1/dist/vendor.bundle.js:38426:61 [angular]
at Object.onInvoke (file:///D:/angular/testing1/dist/vendor.bundle.js:28762:37) [angular]
at Zone.webpackJsonp.528.Zone.run (file:///D:/angular/testing1/dist/polyfills.bundle.js:2591:43) [<root> => angular]
at NgZone.run (file:///D:/angular/testing1/dist/vendor.bundle.js:28631:62) [<root>]
So angular2router
funktioniert nicht ohne <base>
und index.html
kann meine lokalen Dateien mit <base>
Wie kann ich sie lösen nicht finden?
Setzen Sie einfach aber mit. –