framework7io/framework7 · error · Error

Framework7: There is no View with "${anotherViewName}" name

Error message

Framework7: There is no View with "${anotherViewName}" name that was specified in this route

What it means

Routes can declare `viewName` so navigation is redirected to a specific View. During `navigate`, if the route specifies a viewName and no View with that name is registered on the app, the navigation throws because the target View does not exist.

Source

Thrown at src/core/modules/router/navigate.js:679

      .replace('///', '/')
      .replace('//', '/');
  }
  if (createRoute) {
    route = extend(router.parseRouteUrl(navigateUrl), {
      route: extend({}, createRoute),
    });
  } else {
    route = router.findMatchingRoute(navigateUrl);
  }

  if (!route) {
    return router;
  }
  if (route.route && route.route.viewName) {
    const anotherViewName = route.route.viewName;
    const anotherView = app.views[anotherViewName];
    if (!anotherView) {
      throw new Error(
        `Framework7: There is no View with "${anotherViewName}" name that was specified in this route`,
      );
    }
    if (anotherView !== router.view) {
      return anotherView.router.navigate(navigateParams, navigateOptions);
    }
  }

  if (route.route.redirect) {
    return redirect.call(router, 'forward', route, navigateOptions);
  }

  const options = {};
  if (route.route.options) {
    extend(options, route.route.options, navigateOptions);
  } else {
    extend(options, navigateOptions);
  }

View on GitHub (pinned to 6557591266)

Solutions

  1. Create the referenced View with the exact name: `app.views.create('.view-stats', { name: 'stats' })`
  2. Fix the viewName in the route to match an existing View's registered name
  3. Remove viewName from the route if it should navigate in the current View
  4. Check Object.keys(app.views) to confirm which view names exist

Example fix

// before
routes = [{ path: '/stats/', viewName: 'stats' }]; // no view named 'stats'

// after
app.views.create('.view-stats', { name: 'stats' });
routes = [{ path: '/stats/', viewName: 'stats' }];
Defensive patterns

Strategy: validation

Validate before calling

if (route.route && route.route.viewName && !app.views[route.route.viewName]) {
  throw new Error(`View "${route.route.viewName}" referenced by route does not exist`);
}

Type guard

function viewExists(app, name) {
  return !!app.views && Object.prototype.hasOwnProperty.call(app.views, name);
}

Try / catch

try {
  router.navigate('/stats/');
} catch (e) {
  if (/no View with/.test(e.message)) {
    console.error('Create the named View or fix route.viewName');
  } else throw e;
}

Prevention

When it happens

Trigger: A route definition like `{ path: '/stats/', viewName: 'stats' }` while `app.views.stats` was never created or was created under a different name.

Common situations: Typo in viewName vs the name passed to `app.views.create(..., { name })`; the target View was removed/destroyed at runtime; route config copied from a multi-view demo without creating the views.

Related errors


AI-assisted analysis of framework7io/framework7@6557591266 (2026-09-02). Data as JSON: /api/errors/f54ac8c1c28cc9f8. Report an issue: GitHub.