Nuxt.js: Instability problems: Nuxt.js server responds very slowly on local / dev environments

Created on 9 Aug 2019  ยท  33Comments  ยท  Source: nuxt/nuxt.js

Version

v2.8.1

Reproduction link

http://jsfiddle.net

Steps to reproduce

Just run npm update, then load any pages on the site (on dev / localhost), and notice: many pages either dont load, or reload. The console is also flooded with messages. I've included the diff'd package-lock.json.

What is expected ?

Should not be seeing any slowness.

What is actually happening?

After an npm update, this issue came back: https://github.com/nuxt/nuxt.js/issues/3566

Nuxt.js server responds very slowly, even on local / dev environments. The console is flooded with workbox messages, and a lot of pages on my site don't load, or reload.

Something broke because of the updated package-lock.json below.

Using CacheFirst to respond to '/_nuxt/icons/icon_64.9mld2VBMsQ$.png'  Router is responding to: /__webpack_hmr/client
diff --git a/package-lock.json b/package-lock.json
index 1ea16ec..5d84ccd 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5914,9 +5914,9 @@
       }
     },
     "jpeg-js": {
-      "version": "0.3.5",
-      "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.3.5.tgz",
-      "integrity": "sha512-hvaExqwmQDS8O9qnZAVDXGWU43Tbu1V0wMZmjROjT11jloSgGICZpscG+P6Nyi1BVAvyu2ARRx8qmEW30sxgdQ=="
+      "version": "0.3.6",
+      "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.3.6.tgz",
+      "integrity": "sha512-MUj2XlMB8kpe+8DJUGH/3UJm4XpI8XEgZQ+CiHDeyrGoKPdW/8FJv6ku+3UiYm5Fz3CWaL+iXmD8Q4Ap6aC1Jw=="
     },
     "js-base64": {
       "version": "2.5.1",
@@ -9334,6 +9334,16 @@
         "strip-indent": "^1.0.1"
       }
     },
+    "reduce-css-calc": {
+      "version": "2.1.6",
+      "resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-2.1.6.tgz",
+      "integrity": "sha512-+l5/qlQmdsbM9h6JerJ/y5vR5Ci0k93aszLNpCmbadC3nBcbRGmIBm0s9Nj59i22LvCjTGftWzdQRwdknayxhw==",
+      "dev": true,
+      "requires": {
+        "css-unit-converter": "^1.1.1",
+        "postcss-value-parser": "^3.3.0"
+      }
+    },
     "regenerate": {
       "version": "1.4.0",
       "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz",
@@ -10343,13 +10353,13 @@
       }
     },
     "string.prototype.trim": {
-      "version": "1.1.2",
-      "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz",
-      "integrity": "sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo=",
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.0.tgz",
+      "integrity": "sha512-9EIjYD/WdlvLpn987+ctkLf0FfvBefOCuiEr2henD8X+7jfwPnyvTdmW8OJhj5p+M0/96mBdynLWkxUr+rHlpg==",
       "requires": {
-        "define-properties": "^1.1.2",
-        "es-abstract": "^1.5.0",
-        "function-bind": "^1.0.2"
+        "define-properties": "^1.1.3",
+        "es-abstract": "^1.13.0",
+        "function-bind": "^1.1.1"
       }
     },
     "string_decoder": {
@@ -10484,9 +10494,9 @@
       }
     },
     "tailwindcss": {
-      "version": "1.0.6",
-      "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-1.0.6.tgz",
-      "integrity": "sha512-hhdvXpnlYNnxfZCpldMypSWRzgmoQbKBy3namGlsP0Gs+qM8EwF3DBVUPoq8wJYbBFjzrgatE4czWJ6f12Y9+Q==",
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-1.1.0.tgz",
+      "integrity": "sha512-hcxY5MUrY/LcdsX4Xr2aOF24eF4HaxDbHCbDu3W2+bCJRsXRhJmZfAgjipjsyhZult0YAa9HFp14xRXMqwUYTw==",
       "dev": true,
       "requires": {
         "autoprefixer": "^9.4.5",
@@ -10501,7 +10511,8 @@
         "postcss-js": "^2.0.0",
         "postcss-nested": "^4.1.1",
         "postcss-selector-parser": "^6.0.0",
-        "pretty-hrtime": "^1.0.3"
+        "pretty-hrtime": "^1.0.3",
+        "reduce-css-calc": "^2.1.6"
       },

This bug report is available on Nuxt community (#c9617)
bug-report pending-repro workaround available

Most helpful comment

Faced the same issue today. Issue seems to do with websockets and their availability. After restarting the system, it worked fine.

All 33 comments

Update: things seem to be working fine if you run "npm run build && npm run start", though the logs still show lots of messages from workbox.

On running npm run dev, however, none of the pages are loading.

In the console logs:

vendors.app.js:12916 warn [HMR] Update check failed: Error: Manifest request to /_nuxt/e12a06ad6b43baad4b84.hot-update.json timed out.
    at XMLHttpRequest.request.onreadystatechange (http://localhost:3000/_nuxt/runtime.js:92:16)
value @ vendors.app.js:12916
value @ vendors.app.js:12916
value @ vendors.app.js:12916
(anonymous) @ vendors.app.js:12916
handleError @ vendors.app.js:15731
cb @ vendors.app.js:15641
Promise.catch (async)
check @ vendors.app.js:15677
push../node_modules/webpack-hot-middleware/process-update.js.module.exports @ vendors.app.js:15636
processMessage @ vendors.app.js:15513
handleMessage @ vendors.app.js:15373
handleMessage @ vendors.app.js:15336
runtime.js:92 Uncaught (in promise) Error: Manifest request to /_nuxt/e12a06ad6b43baad4b84.hot-update.json timed out.
    at XMLHttpRequest.request.onreadystatechange (runtime.js:92)

Please add a repository or CodeSandbox that clearly shows the problem.

@manniL the issue went away when I cleared all cookies, local storage and other "stuff" in chrome dev tools. So, I cant reproduce this anymore...but I know this problem was there and it happened on doing a "npm update". The pages simply refused to load from the server. I defer to you on what you want to do next.

The problem happes when you run your production version on localhost:300 with pwa/workbox enabled and then run dev on same port without unregister service worker.

This is a long known issue which happens for webpack HMR already registered workbox.

Interesting @pi0 thanks for the extra color here.
So is the lesson that we should NOT run a production version (do a npm run build && npm run start) on localhost:3000 with pwa enabled?
Still seems like an issue in Nuxt, correct? Worth keeping the issue open or is it a duplicate?

As an aside, I'm seeing another intermittent issue on running "npm run dev' where the pages dont load. In that case I have to stop the terminal and run "npm run dev" again. That usually fixes it, but it's a minor annoyance.

This issue is directly related to HMR and Workbox. However, there was an open issue in pwa repository. I think for waiting for a workaround we may open an issue there or mention this as a known issue in the docs. Not really related to nuxt core.

As an aside, I'm seeing another intermittent issue on running "npm run dev' where the pages don't load.

Is this happening even without workbox being registered? A reproduction would be awesome. The #6186 should also potentially fix it for 2.9. you can early test it using nuxt-edge.

@pi0 sounds good and makes sense to keep the PWA one open.

This 2nd issue:
intermittent issue on running "npm run dev' where the pages don't load.
has been happening since as far as I can remember, I can't think of the patterns when it triggers but I'll keep an eye out for it. I had never heard of workbox until this issue was reported yesterday...so no changes there from the basic nuxt installation.

Is it recommended we use Nuxt-edge or is there a way to try out 3.0 beta? Don't see a tag here for it.

@connecteev there is no nuxt 3 beta out yet. nuxt-edge is recommended for personal or projects with a small team working on. All nighly releases are fully automated tested but there might not be a proper changelog and integration tets.

@pi0 cool. Will nuxt-edge become the nuxt-3 beta and eventually nuxt 3?

I did a npm install nuxt-edge
Does one need both of these in package.json for nuxt-edge?

     "nuxt": "^2.0.0",
    "nuxt-edge": "^2.9.0-26089340.de7ed24b",

or only the latter is enough and can I remove the first line? Btw, I couldn't find any good, official information on nuxt-edge from googling around. Is there a guide / more information on nuxt-edge and what is included. Thanks.

Will nuxt-edge become the nuxt-3 beta and eventually nuxt 3?

Not exactly. It is a preview of all _next_ release. Currently 2.9. And only nuxt-edge should be listed.

Regarding docs, we don't have them yet.

@pi0 got it. I just tried a nuxt-edge installation and it keeps squawking about one error after another...not sure what I am missing or whether this just isnt ready for prime time yet.


> nuxt --port 3000


   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   โ”‚                                             โ”‚
   โ”‚   Nuxt.js v2.9.0-26089340.de7ed24b          โ”‚
   โ”‚   Running in development mode (universal)   โ”‚
   โ”‚                                             โ”‚
   โ”‚   Listening on: http://localhost:3000/      โ”‚
   โ”‚                                             โ”‚
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ


 ERROR  Cannot import module '@nuxt/webpack-edge'                                                                                                                                                 12:09:57

  at _import (node_modules/nuxt-edge/node_modules/@nuxt/cli-edge/dist/cli-command.js:75:17)
  at process._tickCallback (internal/process/next_tick.js:68:7)

$ npm install @nuxt/webpack-edge
npm WARN deprecated [email protected]: I wrote this module a very long time ago; you should use something else.
npm WARN [email protected] requires a peer of eslint@>= 5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.

+ @nuxt/[email protected]
added 9 packages from 40 contributors, removed 21 packages, updated 14 packages, moved 44 packages and audited 22823 packages in 29.953s
found 0 vulnerabilities

OneStepAtATime:kb_frontend_nuxt kunalpunjabi$ npm run dev

> nuxt --port 3000


   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   โ”‚                                             โ”‚
   โ”‚   Nuxt.js v2.9.0-26089340.de7ed24b          โ”‚
   โ”‚   Running in development mode (universal)   โ”‚
   โ”‚                                             โ”‚
   โ”‚   Listening on: http://localhost:3000/      โ”‚
   โ”‚                                             โ”‚
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

โ„น Preparing project for development                                                                                                                                                               12:11:01
โ„น Initial build may take a while                                                                                                                                                                  12:11:01

 FATAL  Cannot find module 'vue-meta/package.json'                                                                                                                                                12:11:01

  at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
  at Function.Module._load (internal/modules/cjs/loader.js:562:25)
  at Module.require (internal/modules/cjs/loader.js:690:17)
  at require (internal/modules/cjs/helpers.js:25:18)
  at Resolver.requireModule (node_modules/@nuxt/core-edge/dist/core.js:629:26)
  at Builder.validateTemplate (node_modules/@nuxt/builder-edge/dist/builder.js:5630:38)
  at Builder.build (node_modules/@nuxt/builder-edge/dist/builder.js:5564:12)


   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   โ”‚                                                       โ”‚
   โ”‚   โœ– Nuxt Fatal Error                                  โ”‚
   โ”‚                                                       โ”‚
   โ”‚   Error: Cannot find module 'vue-meta/package.json'   โ”‚
   โ”‚                                                       โ”‚
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

There might be something wrong with npm/yarn. Try cleaning node_modules and lock file. PS: @nuxt/... packages should be automatically installed.

@pi0 Great thanks...that worked. Glad that my site still works with the latest and greatest version of nuxt.

While there are some glitches we encountered in this ticket, I have no issues right now. I'll come back to update this issue if I see anything is odd.

This is not an issue anymore

Faced the same issue today. Issue seems to do with websockets and their availability. After restarting the system, it worked fine.

Same problem again today !

Recently have encountered such a problem!
Has anyone solved it yet?

Same problem here too.
Been having a lot of problem with nuxt in the past but not being able to hot-reload is a pretty big buzzkill.

ๆˆ‘ๅŽ้ขๅ‘็Žฐๅ‡บ็Žฐ็ƒญ่ทŸๆ–ฐๅคฑ่ดฅ็š„ๅŽŸๅ› 

ๆˆ‘็Œœๆต‹ๆ˜ฏๅ› ไธบๅ’Œ็”ต่„‘cpuๅชๆœ‰ไธคไธชๅ†…ๆ ธ, ๅฝ“ๆˆ‘ๅผ€็ฌฌไธ‰ไธช็ฝ‘้กต็š„ๆ—ถๅ€™ๅฐฑไผšๅ‡บ็Žฐ็ƒญๆ›ดๆ–ฐๅคฑ่ดฅ็š„็Žฐ่ฑก, ไธ€็›ดไฟๆŒไธคไธช้กต้ขๅฐฑไธไผšๅ‡บ็Žฐ่ฟ™็ง็Žฐ่ฑก
่ฟ™ๅชๆ˜ฏๆˆ‘็š„็Œœๆต‹

The problem happes when you run your production version on localhost:300 with pwa/workbox enabled and then run dev on same port without unregister service worker.

This is a long known issue which happens for webpack HMR already registered workbox.

Thank you very much for the answer. Quoting your reply because it hasn't got enough attention.

The problem happes when you run your production version on localhost:300 with pwa/workbox enabled and then run dev on same port without unregister service worker.

Thank you. changed the port number. now it's working without any issue

Stopping the service worker via devtools fixes it for me, but it still locks up periodically. Stopping the SW seems to unlock it again.

ๆˆ‘ๅŽ้ขๅ‘็Žฐๅ‡บ็Žฐ็ƒญ่ทŸๆ–ฐๅคฑ่ดฅ็š„ๅŽŸๅ› 

ๆˆ‘็Œœๆต‹ๆ˜ฏๅ› ไธบๅ’Œ็”ต่„‘cpuๅชๆœ‰ไธคไธชๅ†…ๆ ธ, ๅฝ“ๆˆ‘ๅผ€็ฌฌไธ‰ไธช็ฝ‘้กต็š„ๆ—ถๅ€™ๅฐฑไผšๅ‡บ็Žฐ็ƒญๆ›ดๆ–ฐๅคฑ่ดฅ็š„็Žฐ่ฑก, ไธ€็›ดไฟๆŒไธคไธช้กต้ขๅฐฑไธไผšๅ‡บ็Žฐ่ฟ™็ง็Žฐ่ฑก
่ฟ™ๅชๆ˜ฏๆˆ‘็š„็Œœๆต‹

็กฎๅฎžๆ˜ฏ่ฟ™ไธช้—ฎ้ข˜ใ€‚ใ€‚ใ€‚ไฝ†ๆ˜ฏๆˆ‘็”ต่„‘ๆ˜ฏ8ๆ ธ็š„ใ€‚ใ€‚ใ€‚ไนŸๆ˜ฏๅผ€ไธ‰ไธชๅฐฑ็ƒญๆ›ดๅกๆญป

ๆˆ‘ ๅŽ้ข ๅ‘็Žฐ ๅ‡บ็Žฐ ็ƒญ ่ทŸ ๆ–ฐ ๅคฑ่ดฅ ็š„ ๅŽŸๅ› 
P ็Œœๆต‹ ๆ˜ฏ ๅ› ไธบ ๅ’Œ ็”ต่„‘ ็”ต่„‘ ๅ†…ๆ ธ ๅ†…ๆ ธ ๅ†…ๆ ธ ๅ†…ๆ ธ ๅฝ“ ๅฝ“ ๅฝ“ ๅฝ“ ็š„ ็š„ ็š„ ็š„ ็š„ ็š„ ็š„ ็š„ ็›ด ็›ด ็›ด ็›ด ็›ด ็›ด ็›ด ็›ด ็›ด
็›ด ๆˆ‘

็กฎๅฎž ๆ˜ฏ ่ฟ™ไธช ้—ฎ้ข˜ ... ไฝ†ๆ˜ฏ ๆˆ‘ ็”ต่„‘ ๆ˜ฏ 8 ๆ ธ ็š„ ... ไนŸๆ˜ฏ ๅผ€ ไธ‰ไธช ๅฐฑ ็ƒญ ๆ›ด ๅก ๆญป

ะกะฟะฐัะธะฑะพ

Deleting and Unregistering the service worker did the fix for me. Please see the photo below

Screenshot 2020-05-18 at 09 41 05

Hopefully these workarounds are temporary and the nuxt team looks into the stability issues....not good if this happens to production users.

Hopefully these workarounds are temporary and the nuxt team looks into the stability issues....not good if this happens to production users.

This issue has never happened in prod so far. The reason, as well as a workaround, is also known. There is nothing to worry about in production environments!

The problem happes when you run your production version on localhost:300 with pwa/workbox enabled and then run dev on same port without unregister service worker.

This is a long known issue which happens for webpack HMR already registered workbox.

Hopefully these workarounds are temporary and the nuxt team looks into the stability issues....not good if this happens to production users.

I agree with @manniL. This will only happen in local as well. You need to have both dev and prod environment with the same URL and port for this to happen.

warn [HMR] Update check failed: Error: Manifest request to/_nuxt/e12a06ad6b43baad4b84.hot-update.json timed out

i have the same problem when i run dev with NODE_ENV=production, delete Cache Storage in browser an then run dev width NODE_ENV=development

Deleting and Unregistering the service worker did the fix for me. Please see the photo below

Screenshot 2020-05-18 at 09 41 05

it work for me

ๆˆ‘ๅŽ้ขๅ‘็Žฐๅ‡บ็Žฐ็ƒญ่ทŸๆ–ฐๅคฑ่ดฅ็š„ๅŽŸๅ› 
ๆˆ‘็Œœๆต‹ๆ˜ฏๅ› ไธบๅ’Œ็”ต่„‘cpuๅชๆœ‰ไธคไธชๅ†…ๆ ธ, ๅฝ“ๆˆ‘ๅผ€็ฌฌไธ‰ไธช็ฝ‘้กต็š„ๆ—ถๅ€™ๅฐฑไผšๅ‡บ็Žฐ็ƒญๆ›ดๆ–ฐๅคฑ่ดฅ็š„็Žฐ่ฑก, ไธ€็›ดไฟๆŒไธคไธช้กต้ขๅฐฑไธไผšๅ‡บ็Žฐ่ฟ™็ง็Žฐ่ฑก
่ฟ™ๅชๆ˜ฏๆˆ‘็š„็Œœๆต‹

็กฎๅฎžๆ˜ฏ่ฟ™ไธช้—ฎ้ข˜ใ€‚ใ€‚ใ€‚ไฝ†ๆ˜ฏๆˆ‘็”ต่„‘ๆ˜ฏ8ๆ ธ็š„ใ€‚ใ€‚ใ€‚ไนŸๆ˜ฏๅผ€ไธ‰ไธชๅฐฑ็ƒญๆ›ดๅกๆญป

ๆˆ‘่ฎคไธบๆ˜ฏๅ› ไธบๆต่งˆๅ™จๆœ‰่ฟžๆŽฅๆ•ฐ้™ๅˆถ, ๅ› ไธบๆˆ‘็œ‹ๅˆฐๆต่งˆๅ™จไผšๆ˜พ็คบๆญฃๅœจ็ญ‰ๅพ…ๅฏ็”จ็š„ๅฅ—ๆŽฅๅญ—

today I faced this problem, with nuxt-socket-io and nuxt.js and the problem was resolved when I removed
https: { key: fs.readFileSync(path.resolve(__dirname, 'server.key')), cert: fs.readFileSync(path.resolve(__dirname, 'server.crt')) }

or

host: '0.0.0.0',
from my nuxt.config.js (the server object),

Essentially the hot reloading would not work if I was on 192.168 and https, but either by itself was fine

anything idea what may be causing this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

o-alexandrov picture o-alexandrov  ยท  3Comments

vadimsg picture vadimsg  ยท  3Comments

nassimbenkirane picture nassimbenkirane  ยท  3Comments

vadimsg picture vadimsg  ยท  3Comments

mattdharmon picture mattdharmon  ยท  3Comments