Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read properties of undefined (reading 'options') on add @nuxtjs/router to Nuxt 3 project #123

Open
TokugawaTakeshi opened this issue Dec 29, 2022 · 1 comment

Comments

@TokugawaTakeshi
Copy link

TokugawaTakeshi commented Dec 29, 2022

I got error

ERROR Cannot start nuxt: Cannot read properties of undefined (reading 'options') 13:12:10
at nuxtModule (node_modules@nuxtjs\router\dist\module.js:21:16)

once tried to add the @nuxtjs/router module to my Nuxt3 project.
The log refers to:

 const nuxtModule = function(moduleOptions) {

  const DEFAULTS = {
    path: this.options.srcDir,
    fileName: "router.js",
    keepDefaultRouter: false
  };

  // ...

where this is undefined.

Is it because some TypeScript or nuxt configuration?

All append the listings and the whole project.

Nuxt configuration

export default defineNuxtConfig({
  buildDir: "03-LocalDevelopmentBuild/ClientAndRenderingServer",
  dir: {
    assets: "SharedAssets",
    layouts: "Layouts",
    pages: "Pages",
    plugins: "NuxtPlugins"
  },
  srcDir: "01-Source/Implementation/Elements/ClientAndRenderingServer",
  modules: [
    [
      "@nuxtjs/router",
      {
        path: "01-Source/Implementation/Elements/ClientAndRenderingServer/Routing",
        fileName: "router.ts"
      }
    ]
  ]
});

Typescript configuration

{
  "compilerOptions": {

    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,

    "strict": true,
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "noUnusedParameters": false, /* Actual for Vue3; see https://github.com/vuejs/vue-next/issues/4668 */
    "experimentalDecorators": true,

    "baseUrl": "./01-Source"

  },
  "ts-node": {
    "require": [
      "tsconfig-paths/register"
    ]
  }
}
@MartinX3
Copy link

You should be able to remove this package for nuxt 3
https://nuxt.com/docs/getting-started/routing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants