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 start nuxt: Cannot find module 'nuxt/lib/app/router' in nuxt3 #113

Open
PhenomEY opened this issue Feb 6, 2022 · 5 comments
Open

Comments

@PhenomEY
Copy link

PhenomEY commented Feb 6, 2022

i cant get this module to run in nuxt3.

nuxt.config.ts:

buildModules: [ ['@nuxtjs/router', { keepDefaultRouter: true }] ]

error while running:
Cannot start nuxt: Cannot find module 'nuxt/lib/app/router'

router.js:

export function createRouter(ssrContext, createDefaultRouter, routerOptions, config, store) {
const options = routerOptions ? routerOptions : createDefaultRouter(ssrContext, config).options

return new Router({
...options,
routes: options.routes
})
}

@oleghalin
Copy link

Having other issue on clean Nuxt 3:

 [vite] Internal server error: Failed to resolve import "../router.js" from "virtual:nuxt:/app/nuxt-test/.nuxt/router.js". Does the file exist?  

@tol64
Copy link

tol64 commented May 29, 2022

Version 1.7.0 in Nuxt 3:

{
...
  "devDependencies": {
    "nuxt": "3.0.0-rc.3",
  },
  "dependencies": {
    "@nuxtjs/router": "^1.7.0",
  }
}

If you include the module in the modules section:

import { defineNuxtConfig } from 'nuxt';

export default defineNuxtConfig({
...
  modules: [
    '@nuxtjs/router',
  ],
...
});

Then we get this error:

ERROR  10:01:40 PM [vite] Internal server error: Failed to resolve import "../router.js" from "virtual:nuxt:C:\laragon\www\nuxt3\test-02\.nuxt\router.js". Does the file exist?                                                                             22:01:40  
  Plugin: vite:import-analysis
  File: virtual:nuxt:C:/laragon/www/nuxt3/test-02/.nuxt/router.js
  1  |  import { createRouter as customCreateRouter } from '../router.js'
     |                                                      ^
  2  |
  3  |
      at formatError (C:\laragon\www\nuxt3\test-02\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:38663:46)
      at TransformContext.error (C:\laragon\www\nuxt3\test-02\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:38659:19)
      at normalizeUrl (C:\laragon\www\nuxt3\test-02\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:56830:26)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async TransformContext.transform (C:\laragon\www\nuxt3\test-02\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:56979:57)
      at async Object.transform (C:\laragon\www\nuxt3\test-02\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:38900:30)
      at async doTransform (C:\laragon\www\nuxt3\test-02\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:55857:29)

At https://modules.nuxtjs.org/, you can see that @nuxtjs/router is not currently supported in Nuxt 3.

2022-05-29_215550

@k11q
Copy link

k11q commented Nov 22, 2022

@atinux I have similar problem. I need this importantly. Is this fixable?

@k11q
Copy link

k11q commented Nov 22, 2022

@atinux I have similar problem. I need this importantly. Is this fixable?

After updating to latest nuxt release, the module doesn't seem to work at all

@k11q
Copy link

k11q commented Nov 22, 2022

@atinux I have similar problem. I need this importantly. Is this fixable?

After updating to latest nuxt release, the module doesn't seem to work at all

I solved it. Anyone looking to add multiple subdomain with nuxt3, without any package, have a look at this repo https://github.com/zernonia/keypress

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

4 participants