ng serve - error on vendor.bundle.js
Please provide us with the following information:
OS?
cublinux
Versions.
angular-cli: 1.0.0-beta.26 node: 7.2.1 os: linux x64 @angular/common: 2.4.4 @angular/compiler: 2.4.4 @angular/core: 2.4.4 @angular/forms: 2.4.4 @angular/http: 2.4.4 @angular/platform-browser: 2.4.4 @angular/platform-browser-dynamic: 2.4.4 @angular/router: 3.4.4 @angular/compiler-cli: 2.4.4
Repro steps.
It was an application created by angular-cli. I'm working with routes, making some changer to deal with two routes-outlet. Now in the great part of times that I run >ng serve I got an error with vendor.bundle.js, in diferent lines that freezes my browser and I cant run the application.
The log given by the failure.
This error shows in browser console:
Angular is running in the development mode. Call enableProdMode() to enable the production mode. vendor.bundle.js:1102:5 Error: Script terminated by timeout at: ZoneDelegate.prototype.scheduleTask@http://localhost:4200/vendor.bundle.js:111027:21 Zone.prototype.scheduleMicroTask@http://localhost:4200/vendor.bundle.js:110927:20 scheduleResolveOrReject@http://localhost:4200/vendor.bundle.js:111295:9 ZoneAwarePromise.prototype.then@http://localhost:4200/vendor.bundle.js:111384:17 Router.prototype.executeScheduledNavigation@http://localhost:4200/vendor.bundle.js:25320:13 Router.prototype.processNavigations/<@http://localhost:4200/vendor.bundle.js:25264:17 MergeMapSubscriber.prototype._tryNext@http://localhost:4200/vendor.bundle.js:17758:22 MergeMapSubscriber.prototype._next@http://localhost:4200/vendor.bundle.js:17748:13 MergeMapSubscriber.prototype.notifyComplete@http://localhost:4200/vendor.bundle.js:17800:13 InnerSubscriber.prototype._complete@http://localhost:4200/vendor.bundle.js:95107:9 Subscriber.prototype.complete@http://localhost:4200/vendor.bundle.js:457:13 subscribeToResult/<@http://localhost:4200/vendor.bundle.js:671:17 ZoneDelegate.prototype.invoke@http://localhost:4200/vendor.bundle.js:111004:17 NgZone.prototype.forkInnerZoneWithAngularBehavior/this.inner<.onInvoke@http://localhost:4200/vendor.bundle.js:32639:28 ZoneDelegate.prototype.invoke@http://localhost:4200/vendor.bundle.js:111003:17 Zone.prototype.run@http://localhost:4200/vendor.bundle.js:110875:24 scheduleResolveOrReject/<@http://localhost:4200/vendor.bundle.js:111297:52 ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor.bundle.js:111037:21 NgZone.prototype.forkInnerZoneWithAngularBehavior/this.inner<.onInvokeTask@http://localhost:4200/vendor.bundle.js:32630:28 ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor.bundle.js:111036:21 Zone.prototype.runTask@http://localhost:4200/vendor.bundle.js:110913:28 drainMicroTaskQueue@http://localhost:4200/vendor.bundle.js:111195:25 vendor.bundle.js:111027:21

Mention any other details that might be useful.
The ng server seems to build a valid version:
** NG Live Development Server is running on http://localhost:4200. ** Hash: 29ebe35476fd098584c8 Time: 15880ms chunk {0} main.bundle.js, main.bundle.map (main) 48.5 kB {2} [initial] [rendered] chunk {1} styles.bundle.js, styles.bundle.map (styles) 9.96 kB {3} [initial] [rendered] chunk {2} vendor.bundle.js, vendor.bundle.map (vendor) 3.67 MB [initial] [rendered] chunk {3} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered] webpack: bundle is now VALID.
Thanks! We'll be in touch soon.
Do you think you can fork and modify this sample repo https://github.com/meligy/routing-angular-cli so that you can produce this problem?
Also, have you tested in other browsers?
This seems like a problem in your application, not in the CLI. You have some logic that is causing that timeout error.
If you can find a simple repro that shows this is a CLI issue I can reopen, but right now this looks like a question for Stack Overflow.
Thanks @Meligy ! Your example works fine to me ! But my example keeps getting problems ... I removed the guards in the routes and it backs to normal, runing ng serve !
Okay Recently I fetched this problem I have very simple solution for solve this Issue , follow these steps:
go to these directories src-> app-> index.html open the index.html and find
<base href="your app name "> change this to <base href="/">
Hello @Sachin124 neither ./ nor / worked for me. The problem seems to be caused by my file structure. But I'm not quite sure what is the root cause. My server also has a src and dist folders. My file structure is like this:
/dist
/www (angular application)
/src
- index.html
/dist
- index.html
- bundled js/css files that are not served when
when the index.html is served by Express)
/js
- index.js
- compiled js files from TS server
/src (ExpressJS server code folder with TS)
/routes
- IndexRoute.ts
- App.ts
- index.ts
In my IndexRoute.ts I send in response the index.html of the Angular app like so res.sendfile("./dist/www/dist/index.html");
I seem to be getting the index.html file but not the bundled scripts and css files. Thank you in advance for the help.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.