Возможно необработанное отклонение после обновления gulp (4.0.2) - PullRequest
0 голосов
/ 05 ноября 2019

У меня есть старый проект angularjs, который внезапно перестал работать . Я обновил gulp до:

CLI version: 2.2.0
Local version: 4.0.2

Я также обновил многие задачи gulp в gulpfile.js следующим образом:

gulp.task('browserify', ['views'], function() {... /* FROM this old syntax*/

gulp.task('browserify', gulp.series('views', function() {... /* TO this new syntax. */

Теперь, когда я запускаю 'gulp', все выглядит нормально,Я получаю следующий вывод:

[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

И все же приложение не может быть запущено. Выдает следующее исключение:

main.js: 43161 Ошибка: переход отменен

<code>    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
\ n \ n \ n "," status ": 404,"конфигурация": { "метод": "GET", "transformRequest": [пустые] "transformResponse": [пустые] "jsonpCallbackParam": "обратный вызов", "кэш": {}, "заголовки": {»Accept ":" text / html "}," url ":" layout / app-view.html "}," statusText ":" Not Found "," xhrStatus ":" complete "}

Трассировка стека для меня довольно бессмысленна. Исключение приводит меня к функциям в файле main.js, которые я не трогал. (По крайней мере, сознательно). Например:

  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))();
      }

ЛюбойСовет приветствуется. Это первый раз, когда я прикасался к gulpfile.js, поэтому есть вероятность, что я что-то пропустил или даже оскорбил.

ОБНОВЛЕНИЕ

Я обновил angular-ui-router до "angular-ui-router": "^1.0.23", теперь я получаю немного другое исключение:

Не удалось загрузить ресурс: сервер ответил с состоянием 404 (не найдено): 4000/auth/auth.html:1 Не удалось loaРесурс d: сервер ответил со статусом 404 (не найдено) main.js: 49669 Ошибка: [$ templateRequest: tpload] Не удалось загрузить шаблон: layout / app-view.html (статус HTTP: 404 не найден) 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")
...