I have an old angularjs project which suddenly stopped to working. I updated gulp to :
CLI version: 2.2.0
Local version: 4.0.2
I also updated many gulp tasks in gulpfile.js in the following fashion:
gulp.task('browserify', ['views'], function() {... /* FROM this old syntax*/
gulp.task('browserify', gulp.series('views', function() {... /* TO this new syntax. */
Now when I run 'gulp' everything seems to be OK. I get the following output:
[11:34:04] Using gulpfile ~\Desktop\FRONTEND\frontend\gulpfile.js
[11:34:04] Starting 'default'...
[11:34:04] Starting 'html'...
[11:34:04] Finished 'html' after 35 ms
[11:34:04] Starting 'browserify'...
[11:34:04] Starting 'views'...
[11:34:04] Finished 'views' after 108 ms
[11:34:04] Starting '<anonymous>'...
[11:34:08] Finished '<anonymous>' after 3.91 s
[11:34:08] Finished 'browserify' after 4.02 s
[11:34:08] Starting 'sass'...
[11:34:08] Finished 'sass' after 6.97 ms
[11:34:08] Starting '<anonymous>'...
[11:34:08] Finished '<anonymous>' after 26 ms
[11:34:08] Finished 'default' after 4.09 s
[Browsersync] Access URLs:
--------------------------------------
Local: http://localhost:4000
--------------------------------------
UI: http://localhost:4001
UI External: http://localhost:4001
--------------------------------------
[Browsersync] Serving files from: ./build
[Browsersync] Watching files...
[Browsersync] File event [change] : build\assets\global\css\components-md.css
[Browsersync] File event [change] : build\assets\global\css\components-rounded.css
[Browsersync] File event [change] : build\assets\global\css\components.css
[Browsersync] File event [change] : build\assets\global\css\plugins-md.css
[Browsersync] File event [change] : build\assets\global\css\plugins.css
And yet, the application can't be launched. It throws the following exception:
main.js:43161 Error: transition superseded
at $StateProvider.$get (main.js:25957) at Object.invoke (main.js:32735) at main.js:32524 at getService (main.js:32678) at injectionArgs (main.js:32703) at Object.invoke (main.js:32727) at main.js:36372 at forEach (main.js:27981) at Object.<anonymous> (main.js:36370) at Object.invoke (main.js:32735) "Possibly unhandled rejection: {}" (anonymous) @ main.js:43161 main.js:43161 Error: transition prevented at $StateProvider.$get (main.js:25958) at Object.invoke (main.js:32735) at main.js:32524 at getService (main.js:32678) at injectionArgs (main.js:32703) at Object.invoke (main.js:32727) at main.js:36372 at forEach (main.js:27981) at Object.<anonymous> (main.js:36370) at Object.invoke (main.js:32735) "Possibly unhandled rejection: {}" (anonymous) @ main.js:43161 main.js:43161 Error: transition aborted at $StateProvider.$get (main.js:25959) at Object.invoke (main.js:32735) at main.js:32524 at getService (main.js:32678) at injectionArgs (main.js:32703) at Object.invoke (main.js:32727) at main.js:36372 at forEach (main.js:27981) at Object.<anonymous> (main.js:36370) at Object.invoke (main.js:32735) "Possibly unhandled rejection: {}" (anonymous) @ main.js:43161 main.js:43161 Error: transition failed at $StateProvider.$get (main.js:25960) at Object.invoke (main.js:32735) at main.js:32524 at getService (main.js:32678) at injectionArgs (main.js:32703) at Object.invoke (main.js:32727) at main.js:36372 at forEach (main.js:27981) at Object.<anonymous> (main.js:36370) at Object.invoke (main.js:32735) "Possibly unhandled rejection: {}" (anonymous) @ main.js:43161 :4000/layout/app-view.html:1 Failed to load resource: the server responded with a status of 404 (Not Found) main.js:43161 Error: transition superseded at $StateProvider.$get (main.js:25957) at Object.invoke (main.js:32735) at main.js:32524 at getService (main.js:32678) at injectionArgs (main.js:32703) at Object.invoke (main.js:32727) at main.js:36372 at forEach (main.js:27981) at Object.<anonymous> (main.js:36370) at Object.invoke (main.js:32735) "Possibly unhandled rejection: {}" (anonymous) @ main.js:43161 main.js:43161 Possibly unhandled rejection: {"data":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body><script id=\"__bs_script__\">//<![CDATA[\n document.write(\"<script async src='/browser-sync/browser-sync-client.js?v=2.26.7'><\\/script>\".replace(\"HOST\", location.hostname));\n//]]></script>\n\n<pre>Cannot GET /layout/app-view.html</pre>\n</body>\n</html>\n","status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","cache":{},"headers":{"Accept":"text/html"},"url":"layout/app-view.html"},"statusText":"Not Found","xhrStatus":"complete"}
The stacktrace is pretty meaningless to me. The exception leads me to functions in the main.js file that I did not touch. (At least not knowingly). For example:
if (!isClass(fn)) {
// http://jsperf.com/angularjs-invoke-apply-vs-switch
// #5388
return fn.apply(self, args);
} else {
args.unshift(null);
return new (Function.prototype.bind.apply(fn, args))();
}
Any advice is appreciated. This is the very first time I have ever touched gulpfile.js, so there is a possibility that I missed or even abused something in it.
UPDATE
I updated angular-ui-router to "angular-ui-router": "^1.0.23"
,
Now I get a slightly different exception:
Failed to load resource: the server responded with a status of 404 (Not Found) :4000/auth/auth.html:1 Failed to load resource: the server responded with a status of 404 (Not Found) main.js:49669 Error: [$templateRequest:tpload] Failed to load template: layout/app-view.html (HTTP status: 404 Not Found) https://errors.angularjs.org/1.7.8/$templateRequest/tpload?p0=layout%2Fapp-view.html&p1=404&p2=Not%20Found
at main.js:34240 at handleError (main.js:55499) at processQueue (main.js:52047) at main.js:52095 at Scope.$digest (main.js:53214) at Scope.$apply (main.js:53602) at done (main.js:47445) at completeRequest (main.js:47702) at XMLHttpRequest.requestLoaded (main.js:47607) (anonymous) @ main.js:49669 main.js:4076 Transition Rejection($id: 0 type: 6, message: The transition errored, detail: Error: [$templateRequest:tpload] Failed to load template: layout/app-view.html (HTTP status: 404 Not Found) https://errors.angularjs.org/1.7.8/$templateRequest/tpload?p0=layout%2Fapp-view.html&p1=404&p2=Not%20Found) $defaultErrorHandler @ main.js:4076 main.js:4078 Error: [$templateRequest:tpload] Failed to load template: layout/app-view.html (HTTP status: 404 Not Found) https://errors.angularjs.org/1.7.8/$templateRequest/tpload?p0=layout%2Fapp-view.html&p1=404&p2=Not%20Found at main.js:34240 at handleError (main.js:55499) at processQueue (main.js:52047) at main.js:52095 at Scope.$digest (main.js:53214) at Scope.$apply (main.js:53602) at done (main.js:47445) at completeRequest (main.js:47702) at XMLHttpRequest.requestLoaded (main.js:47607) $defaultErrorHandler @ main.js:4078 main.js:49669 Error: [$templateRequest:tpload] Failed to load template: auth/auth.html (HTTP status: 404 Not Found) https://errors.angularjs.org/1.7.8/$templateRequest/tpload?p0=auth%2Fauth.html&p1=404&p2=Not%20Found at main.js:34240 at handleError (main.js:55499) at processQueue (main.js:52047) at main.js:52095 at Scope.$digest (main.js:53214) at Scope.$apply (main.js:53602) at done (main.js:47445) at completeRequest (main.js:47702) at XMLHttpRequest.requestLoaded (main.js:47607) (anonymous) @ main.js:49669 main.js:4076 Transition Rejection($id: 1 type: 2, message: The transition has been superseded by a different transition, detail: "null")