Угловой универсальный стартер: не может соответствовать ни одному маршруту.Сегмент URL: «robots.txt» - PullRequest
0 голосов
/ 28 ноября 2018

Я скачал этот угловой универсальный стартер https://github.com/angular/universal-starter.

Установил все зависимости из package.json и попытался запустить проект.Сначала я выполнил команду 'ng build', а после следующей команды 'npm run build: ssr && npm run serve: ssr "

Все работает хорошо, но иногда я ловлю в терминале следующее сообщение:

ERROR { Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'robots.txt'
Error: Cannot match any routes. URL Segment: 'robots.txt'
    at ApplyRedirects.noMatchError (D:\universal-starter-master\universal-starter-master\node_modules\@angular\router\bundles\router.umd.js:2557:20)
    at CatchSubscriber.selector (D:\universal-starter-master\universal-starter-master\node_modules\@angular\router\bundles\router.umd.js:2538:33)
    at CatchSubscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\operators\catchError.js:48:31)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at TapSubscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\operators\tap.js:75:26)
    at resolvePromise (D:\universal-starter-master\universal-starter-master\node_modules\zone.js\dist\zone-node.js:814:31)
    at resolvePromise (D:\universal-starter-master\universal-starter-master\node_modules\zone.js\dist\zone-node.js:771:17)
    at D:\universal-starter-master\universal-starter-master\node_modules\zone.js\dist\zone-node.js:873:17
    at ZoneDelegate.invokeTask (D:\universal-starter-master\universal-starter-master\node_modules\zone.js\dist\zone-node.js:421:31)
    at Object.onInvokeTask (D:\universal-starter-master\universal-starter-master\node_modules\@angular\core\bundles\core.umd.js:16177:37)
    at ZoneDelegate.invokeTask (D:\universal-starter-master\universal-starter-master\node_modules\zone.js\dist\zone-node.js:420:36)
    at Zone.runTask (D:\universal-starter-master\universal-starter-master\node_modules\zone.js\dist\zone-node.js:188:47)
    at drainMicroTaskQueue (D:\universal-starter-master\universal-starter-master\node_modules\zone.js\dist\zone-node.js:595:35)
    at ZoneTask.invokeTask (D:\universal-starter-master\universal-starter-master\node_modules\zone.js\dist\zone-node.js:500:21)
    at ZoneTask.invoke (D:\universal-starter-master\universal-starter-master\node_modules\zone.js\dist\zone-node.js:485:48)
  rejection: Error: Cannot match any routes. URL Segment: 'robots.txt'
    at ApplyRedirects.noMatchError (D:\universal-starter-master\universal-starter-master\node_modules\@angular\router\bundles\router.umd.js:2557:20)
    at CatchSubscriber.selector (D:\universal-starter-master\universal-starter-master\node_modules\@angular\router\bundles\router.umd.js:2538:33)
    at CatchSubscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\operators\catchError.js:48:31)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at TapSubscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\operators\tap.js:75:26),
  promise:
   ZoneAwarePromise {
     __zone_symbol__state: 0,
     __zone_symbol__value: Error: Cannot match any routes. URL Segment: 'robots.txt'
    at ApplyRedirects.noMatchError (D:\universal-starter-master\universal-starter-master\node_modules\@angular\router\bundles\router.umd.js:2557:20)
    at CatchSubscriber.selector (D:\universal-starter-master\universal-starter-master\node_modules\@angular\router\bundles\router.umd.js:2538:33)
    at CatchSubscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\operators\catchError.js:48:31)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at TapSubscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\operators\tap.js:75:26) },
  zone:
   Zone {
     _properties: { isAngularZone: true },
     _parent:
      Zone {
        _properties: {},
        _parent: null,
        _name: '<root>',
        _zoneDelegate: [Object] },
     _name: 'angular',
     _zoneDelegate:
      ZoneDelegate {
        _taskCounts: [Object],
        zone: [Circular],
        _parentDelegate: [Object],
        _forkZS: null,
        _forkDlgt: null,
        _forkCurrZone: [Object],
        _interceptZS: null,
        _interceptDlgt: null,
        _interceptCurrZone: [Object],
        _invokeZS: [Object],
        _invokeDlgt: [Object],
        _invokeCurrZone: [Circular],
        _handleErrorZS: [Object],
        _handleErrorDlgt: [Object],
        _handleErrorCurrZone: [Circular],
        _scheduleTaskZS: [Object],
        _scheduleTaskDlgt: [Object],
        _scheduleTaskCurrZone: [Circular],
        _invokeTaskZS: [Object],
        _invokeTaskDlgt: [Object],
        _invokeTaskCurrZone: [Circular],
        _cancelTaskZS: [Object],
        _cancelTaskDlgt: [Object],
        _cancelTaskCurrZone: [Circular],
        _hasTaskZS: [Object],
        _hasTaskDlgt: [Object],
        _hasTaskDlgtOwner: [Circular],
        _hasTaskCurrZone: [Circular] } },
  task:
   ZoneTask {
     _zone:
      Zone {
        _properties: [Object],
        _parent: [Object],
        _name: 'angular',
        _zoneDelegate: [Object] },
     runCount: 0,
     _zoneDelegates: null,
     _state: 'notScheduled',
     type: 'microTask',
     source: 'Promise.then',
     data:
      ZoneAwarePromise {
        __zone_symbol__state: 0,
        __zone_symbol__value: Error: Cannot match any routes. URL Segment: 'robots.txt'
    at ApplyRedirects.noMatchError (D:\universal-starter-master\universal-starter-master\node_modules\@angular\router\bundles\router.umd.js:2557:20)
    at CatchSubscriber.selector (D:\universal-starter-master\universal-starter-master\node_modules\@angular\router\bundles\router.umd.js:2538:33)
    at CatchSubscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\operators\catchError.js:48:31)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at MapSubscriber.Subscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:93:26)
    at MapSubscriber.Subscriber.error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\Subscriber.js:73:18)
    at TapSubscriber._error (D:\universal-starter-master\universal-starter-master\node_modules\rxjs\internal\operators\tap.js:75:26) },
     scheduleFn: undefined,
     cancelFn: null,
     callback: [Function],
     invoke: [Function] } }

Как я могу это исправить?Чтобы поймать это сообщение, я нажимаю кнопку обновления в браузере много раз.

1 Ответ

0 голосов
/ 30 ноября 2018

Это решение работает.Но я до сих пор не понимаю, почему разработчики не включили robots.txt в проект, если это так просто.Может быть, есть какие-то причины?

...