victorgarciaesgi/nuxt-typed-router

Cannot start nuxt: Cannot read properties of undefined (reading 'routeName')

Closed this issue · 5 comments

9M6 commented

Describe the bug

After installing module, it returns the following error.

 ERROR  Cannot start nuxt:  Cannot read properties of undefined (reading 'routeName')                                                                                                                                                                                                                           6:22:18 AM

  at createTypeValidatePathCondition (node_modules/nuxt-typed-router/dist/module.mjs:243:39)
  at Array.map (<anonymous>)
  at createValidatePathTypes (node_modules/nuxt-typed-router/dist/module.mjs:206:37)
  at createPathsFiles (node_modules/nuxt-typed-router/dist/module.mjs:1033:29)
  at saveGeneratedFiles (node_modules/nuxt-typed-router/dist/module.mjs:1322:16)
  at node_modules/nuxt-typed-router/dist/module.mjs:1578:13
  at node_modules/hookable/dist/index.mjs:48:66
  at Object.run (node_modules/hookable/dist/index.mjs:41:43)
  at node_modules/hookable/dist/index.mjs:48:56
  at async Object.getContents (node_modules/nuxt/dist/index.mjs:655:9)


 ERROR  [unhandledRejection] Cannot read properties of undefined (reading 'routeName')                                                                                                                                                                                                                          6:22:18 AM

  at createTypeValidatePathCondition (node_modules/nuxt-typed-router/dist/module.mjs:243:39)
  at Array.map (<anonymous>)
  at createValidatePathTypes (node_modules/nuxt-typed-router/dist/module.mjs:206:37)
  at createPathsFiles (node_modules/nuxt-typed-router/dist/module.mjs:1033:29)
  at saveGeneratedFiles (node_modules/nuxt-typed-router/dist/module.mjs:1322:16)
  at node_modules/nuxt-typed-router/dist/module.mjs:1578:13
  at node_modules/hookable/dist/index.mjs:48:66
  at Object.run (node_modules/hookable/dist/index.mjs:41:43)
  at node_modules/hookable/dist/index.mjs:48:56
  at async Object.getContents (node_modules/nuxt/dist/index.mjs:655:9)

Expected behavior

Should run normally.

Screenshots
If applicable, add screenshots to help explain your problem.

Environnement infos


  • Operating System: Darwin
  • Node Version: v18.16.0
  • Nuxt Version: 3.6.1
  • Nitro Version: 2.5.1
  • Package Manager: npm@9.5.1
  • Builder: vite
  • User Config: experimental, vite, nitro, devtools, debug, ssr, css, imports, runtimeConfig, modules, apiParty
  • Runtime Modules: @pinia/nuxt@0.4.11, @nuxtjs/tailwindcss@6.8.0, @nuxtjs/i18n@8.0.0-beta.12, @vueuse/nuxt@10.2.1, nuxt-typed-router@3.2.3, nuxt-lodash@2.5.0, nuxt-api-party@0.13.0, nuxt-icon@0.4.2
  • Build Modules: -

Your nuxt.config.ts

// https://nuxt.com/docs/api/configuration/nuxt-config

export default defineNuxtConfig({
  experimental: {
    inlineSSRStyles: false,
  },
  vite: {
    test: {
      globals: true,
      environment: "jsdom",
    },
  },
  nitro: {
    routeRules: {
      edge: {
        redirect: "x/edge/cameras",
      },
    },
    devProxy: {
      "/files/": `${process.env.eg}/files/`,
      "/api/wa/video-upload": `${process.env.wa}/api/wa/video-upload`,
    },
  },
  devtools: {
    enabled: true,
  },
  debug: Boolean(Number(process.env.NUXT_DEBUG)),
  ssr: true,
  css: ["@/assets/css/main.css"],
  imports: {
    dirs: ["stores/**/*"],
  },
  runtimeConfig: {
    public: {
      DM: process.env.dm!,
      VI: process.env.vi!,
      WA: process.env.wa!,
      EG: process.env.eg!,
    },
  },
  modules: [
    [
      "@pinia/nuxt",
      {
        autoImports: ["defineStore"],
      },
    ],
    "@nuxtjs/tailwindcss",
    "@nuxtjs/i18n",
    "@vueuse/nuxt",
    "nuxt-typed-router",
    "nuxt-lodash",
    "nuxt-api-party",
    "nuxt-icon",
  ],
  apiParty: {
    endpoints: {
      DM: {
        url: process.env.dm!,
      },
      VI: {
        url: process.env.vi!,
      },
      WA: {
        url: process.env.wa!,
      },
      EG: {
        url: process.env.eg!,
      },
    },
  },
});
import { defineI18nConfig } from "#i18n";
import en from "@/locales/en.json";
import ja from "@/locales/ja.json";

export default defineI18nConfig(() => ({
  legacy: false,
  strategy: "no_prefix",
  defaultLocale: "ja",
  locale: "ja",
  langDir: "./locales",
  lazy: true,
  messages: {
    en,
    ja,
  },
  locales: [
    { code: "en", name: "English" },
    { code: "ja", name: "日本語" },
  ],
  detectBrowserLanguage: {
    redirectOn: "root", // recommended
    useCookie: true,
    cookieKey: "i18n_redirected",
  },
}));

Can you run npx tree-node-cli ./pages ?

9M6 commented

@victorgarciaesgi

pages
├── [project]
│   ├── annotations
│   │   └── index.vue
│   ├── datasets
│   │   ├── [dataset].vue
│   │   └── index.vue
│   ├── datasets.vue
│   ├── edge
│   │   ├── cameras
│   │   │   ├── [path].vue
│   │   │   └── index.vue
│   │   ├── cameras.vue
│   │   ├── captured-images.vue
│   │   ├── history.vue
│   │   ├── index.vue
│   │   ├── report.vue
│   │   ├── settings
│   │   │   ├── cameras.vue
│   │   │   ├── models.vue
│   │   │   └── plc.vue
│   │   └── settings.vue
│   ├── edge.vue
│   ├── index.vue
│   ├── inspections
│   │   ├── ad
│   │   │   └── [id].vue
│   │   ├── ad.vue
│   │   ├── index.vue
│   │   ├── train
│   │   │   ├── 1.vue
│   │   │   ├── 2.vue
│   │   │   ├── 3.vue
│   │   │   └── 4.vue
│   │   └── train.vue
│   ├── inspections.vue
│   ├── settings
│   │   └── index.vue
│   ├── settings.vue
│   ├── workflows
│   │   ├── [id]
│   │   │   ├── assess.vue
│   │   │   ├── compare.vue
│   │   │   ├── history.vue
│   │   │   ├── index.vue
│   │   │   ├── inspect.vue
│   │   │   ├── overview.vue
│   │   │   ├── videos
│   │   │   │   ├── [video].vue
│   │   │   │   └── index.vue
│   │   │   └── videos.vue
│   │   ├── [id].vue
│   │   ├── editor
│   │   │   └── [id].vue
│   │   ├── editor.vue
│   │   ├── index.vue
│   │   ├── list.vue
│   │   ├── manual
│   │   │   ├── 1.vue
│   │   │   ├── 2.vue
│   │   │   └── 3.vue
│   │   ├── manual.vue
│   │   ├── new
│   │   │   ├── 1.vue
│   │   │   ├── 2.vue
│   │   │   ├── 3.vue
│   │   │   ├── 4.vue
│   │   │   └── index.vue
│   │   ├── new.vue
│   │   ├── record
│   │   │   └── [step].vue
│   │   ├── record.vue
│   │   ├── upload.vue
│   │   └── videos.vue
│   └── workflows.vue
├── [project].vue
├── auth
│   ├── index.vue
│   └── logout.vue
├── auth.vue
├── error
│   ├── 401.vue
│   ├── 404.vue
│   ├── 500.vue
│   ├── [code].vue
│   └── index.vue
├── error.vue
├── index
│   └── index.vue
├── index.vue
├── task
│   └── index.vue
├── task.vue
├── user
│   └── settings.vue
└── user.vue

Ok I think it comes from the index/index.vue, not sure why i'll look

9M6 commented

Thank you @victorgarciaesgi, very much appreciated!

Fixed in 3.2.4