title: ncaught TypeError: Cannot use 'in' operator to search for 'path' in undefined vue router
body: <p>when I am randomly moving from one component to another on any point vue gives this error and then i can not move another component.</p>
  <p>This error is not on any specific component it can happen anywhere.</p>
  <p>error</p>
  <pre><code>Uncaught TypeError: Cannot use 'in' operator to search for 'path' in undefined
      at Object.resolve (vue-router.esm-bundler.js?6c02:2728)
      at matchView (index.esm.js?bec5:446)
      at Array.find (&lt;anonymous&gt;)
      at findViewItemByPath (index.esm.js?bec5:464)
      at Object.findViewItemByRouteInfo (index.esm.js?bec5:424)
      at Object.canStart (index.js?8a30:805)
      at eval (ion-app_8.entry.js?49af:707)
      at canStart (swipe-back-53c5a7dd.js?05d4:8)
      at pointerDown (index-f49d994d.js?14e6:251)
  </code></pre>
  <p>Here is my router index.js file</p>
  <pre><code>import { createRouter, createWebHistory } from '@ionic/vue-router';
  
  import Tabs from '../views/Tabs.vue'
  import SignIn from &quot;@/views/Signin.vue&quot;;
  import Signup from &quot;@/views/Signup.vue&quot;;
  import { TokenService } from &quot;@/services/token.service&quot;;
  
  const routes = [
    {
      path: '/',
      redirect: '/tabs/tab1'
    },
    {
      path: '/search-workers',
      component: () =&gt; import('@/views/SearchWorker.vue')
    },
    
    {
      path: '/login',
      component: SignIn,
      meta: {
        public: true,
        onlyWhenLoggedOut: true
      }
    },
    {
      path: '/signup',
      component: Signup,
      meta: {
        public: true,
        onlyWhenLoggedOut: true
      }
    }
  ]
  
  const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
  })
  
  router.beforeEach((to, from, next) =&gt; {
    const isPublic = to?.matched?.some(record =&gt; record?.meta?.public);
    const onlyWhenLoggedOut = to?.matched.some(
        record =&gt; record?.meta?.onlyWhenLoggedOut
    );
    const loggedIn = !!TokenService.getToken();
  
    if (!isPublic &amp;&amp; !loggedIn) {
      return next({
        path: &quot;/login&quot;,
        query: { redirect: to?.fullPath }
      });
    }
  
    if (loggedIn &amp;&amp; onlyWhenLoggedOut) {
      return next(&quot;/tabs/tab1&quot;);
    }
  
    next();
  });
  
  export default router
  
  </code></pre>
  <p>This is how i am using link router in my components</p>
  <pre><code>&lt;ion-item router-link=&quot;/search-workers&quot; v-if=&quot;userInfo?.role_id == 9&quot; @click=&quot;opened()&quot;&gt;
  Search Worker
  &lt;/ion-item&gt;
  </code></pre>
  <p>What could be the reason of it? How we can resolve it?</p>