question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nuxt Generate finished but did not exit

See original GitHub issue

This may not be an issue, but might be more of a question. When I run npm run generate I get the following error:

⚠ Nuxt Warning 

The command 'nuxt generate' finished but did not exit after 5s
This is most likely not caused by a bug in Nuxt.js
Make sure to cleanup all timers and listeners you or your plugins/modules start.
Nuxt.js will now force exit

DeprecationWarning: Starting with Nuxt version 3 this will be a fatal error  

I am not using Vuex, but I am using the onSnapshot method, which is what I have narrowed the issue down to. It appears that the onSnapshot method uses a listener which is causing the error. So I looked at the firebase docs and read the following - link:

var unsubscribe = db.collection("cities")
    .onSnapshot(function (){
      // Respond to data
      // ...
    });

// Later ...

// Stop listening to changes
unsubscribe();

So I tried to save the snapshot to something like this.destroySnapshot, then in the beforeDestroy lifecycle hook, call this.destroySnapshot(). However, when I run npm run generate again, it still gives me the same error.

So my real question is, is this an issue with Nuxt, Firebase, or me being a total noob? I am specifically worried about the line saying Starting with Nuxt version 3 this will be a fatal error

If you want to see my code, it is in my nuxt-sandbox repo.

And more than anything, thank you for creating Nuxt-Fire.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
krisismcommented, Apr 6, 2020

If looking for a similar solution with Firestore, you can use firedb.terminate() instead of ‘goOffline()’ in the nuxt.config.js hook mentioned above =) (Thanks for this thread, helped me a lot!)

1reaction
lupascommented, Apr 6, 2020

@krisism Awesome, I was actually looking for that since the issue is also there with Firestore. Thanks for the tip!

Still trying to find a way to call this in the generate.done hook though since this.$fireStore is not accessible there…

https://github.com/nuxt-community/firebase-module/issues/93 is open for trying to fix this within this module.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do i fix Nuxt Warning 'nuxt build finished but did not exit ...
The command 'nuxt build' finished but did not exit after 5s │ │ │ │ This is most likely not caused by a...
Read more >
Nuxt "generate" routes by Firebase data: "Is finished but did ...
For version 9 of the Firebase SDK and assuming you've set up the plugin as detailed in this article: nuxt.config.js import {db} from...
Read more >
Commands and Deployment - Nuxt
Nuxt comes with a set of useful commands, both for development and production purpose.
Read more >
nuxt-fire - Awesome JS
While this fix fixes nuxt generate, it re-introduces the "The command 'nuxt generate' finished but did not exit after 5s" warning.
Read more >
Creating Server-side Rendered Vue.js Apps Using Nuxt.js
Then send this complete page to the browser along with the ability to make further changes and still have dynamic page content (the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found