nuxt: Object(...) is not a function

Version

v2.6.3

Reproduction link

https://nuxtjs.org

Steps to reproduce

Not sure yet unfortunately

What is expected ?

Nuxt works

What is actually happening?

An Object(...) is not a function error is shown when setContext is called in .nuxt/index.js

Sometimes during development this error happens. I am not exactly sure yet what triggers it, sometimes it happens once a day and sometimes 10+ times.

What I know about it so far:

  • The error is caused because the .nuxt/utils import returns an empty object
  • The utils file does exist and when executed with --experimental-modules node has a 0 exit status (so no syntax errors in the file)
  • Deleting the utils module from require.cache did not solve the issue
  • Restarting the dev server made the error go away
  • It doesnt seem to have to do with a long running dev server, this morning I had it within 20mins of starting work

Although restarting the dev server is a good enough solution, rebuilding the whole project can take quite a bit of time which can be frustrating.

Additional comments?

First reported here: https://stackoverflow.com/questions/55949558/how-to-solve-object-is-not-a-function-error-in-nuxt

Screenshot of error: https://i.imgur.com/CEoHxQq.png

<div align="right">This bug report is available on Nuxt community (#c9157)</div>

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 11
  • Comments: 16 (3 by maintainers)

Most upvoted comments

SO? No one has a solution and the issue has been closed? I’m on my first project with Nuxt and honestly I’m really disappointed by the complete uselessness of the error messages that are thrown…