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

"resolveRouteComponents is not defined" on $router.push #123

Closed
ianchak opened this issue Jun 10, 2020 · 17 comments · Fixed by nuxt/nuxt#7591
Closed

"resolveRouteComponents is not defined" on $router.push #123

ianchak opened this issue Jun 10, 2020 · 17 comments · Fixed by nuxt/nuxt#7591
Labels
bug Something isn't working

Comments

@ianchak
Copy link

ianchak commented Jun 10, 2020

Version

@nuxt/content: 1.3.1
nuxt-edge: 2.13.0-26519060.8933d375

Using target: static and ssr: true in nuxt config.

Reproduction Link

Tried to fork this to create one: https://codesandbox.io/s/nuxtcontent-demo-l164h
But before I changed anything on codesandbox fails with "Uncaught Error: Module build failed: Error: ENOENT: no such file or directory, open '/sandbox/node_modules/html-entities/lib/index.js'" error.

Anyway, if it would not fail it would be probably something like this: https://codesandbox.io/s/nuxtcontent-demo-dgfy5

Steps to reproduce

If i use this.$router.push() from a method for example triggered by a click event, it shows a 500 error page with the text of "resolveRouteComponents is not defined", but just for a brief moment, then the navigation succeeds. No error was written to the console.

What is Expected?

It should not display an error page when navigating. Not even for a brief moment.

What is actually happening?

It shows a 500 error page for a 100ms or so.

nuxt_content_500

@ianchak ianchak added the bug Something isn't working label Jun 10, 2020
@ianchak
Copy link
Author

ianchak commented Jun 10, 2020

Seem like the problem was with nuxt-edge and not nuxt/content. I've reverted to 2.12.2 and in universal mode I cannot reproduce this.

@ianchak ianchak closed this as completed Jun 10, 2020
@rajesh-h
Copy link

@ianchak I am also getting same error on latest nuxt-edge.

@rajesh-h
Copy link

@pi0 in case you know the actual reason for this behaviour please do let me know

@rajesh-h
Copy link

I see this behavior is observed only on my mobile chrome browser. my laptop browser doesn't throw this error.

So not sure how do I debug this. tried with nuxt 2.13

@skoulix
Copy link

skoulix commented Jun 19, 2020

Same issue for me with Nuxt 2.13.0

II have a common navbar in my app assigning paths dynamically with the ":to" property. The page is not changing and I have the "resolveRouteComponents is not defined" error message.

@rajesh-h
Copy link

@skoulix atleast you feel where the actual error might be happening. I did not come to know what was happening.

I actually created new nuxt project from scratch and imported my code from old app to new. Now I do not have that error anynmore.

Even earlier also I had this issue only on Mobile browser. I didn't face issue in normal browser.

In my new project I ignored few modules which I had in my package.json

New Repo - https://github.com/rajesh-h/cs_com
Old Repo - https://github.com/rajesh-h/cs_content

New site (Still in Dev) - https://cscom.netlify.app (Please let me know if you see the error by any chance)

Probably you can have a look at my old package.json and see is there any common module like nuxt-polyfill or Vue-observe-visibility etc:

I didn't go to see what exactly was causing issue.

@skoulix
Copy link

skoulix commented Jun 19, 2020

@rajesh-h

Thanks for your reply. I will check and let you know.

For me it happens whenever I'm calling the this.$router.push() like @ianchak mentioned. Same issue. The message appears stays for a while and then disappears with the next page rendered as normal.

@rajesh-h
Copy link

In my case I did not have this.$router.push() but I had nuxt-link's.

do you have this behavior on laptop/desktop browser as well? in my case it was only on Mobile. So very difficult to debug where is the problem.

All the best , hope you resolve it soon.

@weihao
Copy link

weihao commented Jun 21, 2020

@ianchak same issue.

@pi0 pi0 reopened this Jun 21, 2020
@skoulix
Copy link

skoulix commented Jun 22, 2020

It happens every time the Router is being used either by using the to property directly to pass the links or using the $router.push() programatically. To my project it doesn't matter if it's a mobile browser or not, like other people mentioned. If I downgrade to previous version of Nuxt everything works and the same error doesn't exists.

@ReindDooyeweerd
Copy link

ReindDooyeweerd commented Jun 22, 2020

Same issue over here, it just flashes by on the screen with the following message,

resolveRouteComponents is not defined
An error occurred while rendering the page. Check developer tools console for details.

No errors however in the console or on the commandline. It just flashes by while everything seems to work fine. Doesn't matter if i'm on mobile or desktop view, dev or production mode.

▸ Environment: development
▸ Rendering:   server-side
▸ Target:      server

@rajesh-h
Copy link

rajesh-h commented Jun 22, 2020

I am not sure whoever is facing issue here do you have loading :false in nuxt.config.js?
Can you try to making to loading :true ? I found this on another thread. Even in my case it did wrk I guess.

Credit goes to Davounet on this thread - nuxt/nuxt#6159 (comment)

@skoulix
Copy link

skoulix commented Jun 22, 2020

I am not sure whoever is facing issue here do you have loading :false in nuxt.config.js?
Can you try to making to loading :true ? I found this on another thread. Even in my case it did wrk I guess

Yes this is it. I indeed had the loading: false and it works fine if I set it back to true like you suggested. It never crossed my mind that this was coming from the settings.

So is this considered a bug, waiting to be addressed in one of the upcoming releases?

Thanks for your reply @rajesh-h

@rajesh-h
Copy link

@skoulix I think so it should be treated as bug. One good news is @pi0 has re-opened this issue. hope he will find a solution for this.

@codeofsumit
Copy link

codeofsumit commented Jun 23, 2020

Seeing this as well flashing before any route changes since the new version. I have not adapted anything to the new features and do not use them. It simply started showing as npm installed new minor versions during deployment. Pretty dangerous as users see this on production before I see it (as I haven't actively updated my local version).
Downgrading / fixing the previous version until we can resolve this.

I also have loading: false in my nuxt.config

@pi0
Copy link
Member

pi0 commented Jun 23, 2020

Hi! Sorry for the inconvenience guys. Still couldn't track down what triggered this bug (should be related to _queryChanged triggering) but the root cause is obvious. The hotfix will be landed ASAP (nuxt/nuxt#7591)

@pi0 pi0 reopened this Jun 23, 2020
@pi0 pi0 mentioned this issue Jun 23, 2020
@pi0
Copy link
Member

pi0 commented Jun 24, 2020

Hi! This should be fixed with v2.13.1.

@pi0 pi0 closed this as completed Jun 24, 2020
pi0 pushed a commit that referenced this issue May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants