#NITRO BUG: "ERROR Cannot access '_sharedRuntimeConfig' before initialization" in production
4 messages · Page 1 of 1 (latest)
full logs:
#27 148.4 ERROR Cannot access '_sharedRuntimeConfig' before initialization
#27 148.4
#27 148.4 at useRuntimeConfig (.nuxt/prerender/chunks/nitro/nitro.mjs:6555:5)
#27 148.4 at .nuxt/prerender/chunks/nitro/nitro.mjs:2384:1
#27 148.4 at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
#27 148.4 at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
#27 148.4 at async prerender (node_modules/nitropack/dist/core/index.mjs:1837:44)
#27 148.4 at async node_modules/nuxt/dist/index.mjs:3605:7
#27 148.4 at async build (node_modules/nuxt/dist/index.mjs:5469:5)
#27 148.4 at async Object.run (node_modules/nuxi/dist/chunks/build.mjs:104:5)
#27 148.4 at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1648:16)
#27 148.4 at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1639:11)
#27 148.4 at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1777:7)
#27 148.4
#27 148.4
#27 148.4
#27 148.4 ERROR Cannot access '_sharedRuntimeConfig' before initialization
#27 148.4
#27 ERROR: process "/bin/sh -c npm run build" did not complete successfully: exit code: 1
------
> [frontend build 11/11] RUN npm run build:
148.4 at async build (node_modules/nuxt/dist/index.mjs:5469:5)
148.4 at async Object.run (node_modules/nuxi/dist/chunks/build.mjs:104:5)
148.4 at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1648:16)
148.4 at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1639:11)
148.4 at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1777:7)
148.4
148.4
148.4
148.4 ERROR Cannot access '_sharedRuntimeConfig' before initialization
Based on the information provided in the knowledge sources, I don't have enough specific details to directly address the "Cannot access '_sharedRuntimeConfig' before initialization" error you're experiencing. However, I can provide some general insights and suggestions related to similar issues in Nuxt:
-
This error seems to be related to runtime configuration initialization, which is a known area where issues can occur in Nuxt applications. The Runtime Config documentation (https://nuxt.com/docs/bridge/runtime-config) explains how Nuxt 3 handles runtime configuration differently from Nuxt 2, using a combined
runtimeConfigoption. If you've recently upgraded or changed your configuration, this might be relevant. -
The error message suggests a timing issue where a configuration is being accessed before it's fully initialized. This is similar to the "Cannot access 'renderer$1' before initialization" error discussed in a GitHub issue (https://github.com/nuxt/nuxt/issues/20576), which was related to a race condition in code compilation.
-
Since you mentioned that this error occurs in production and even with an older commit that previously worked, it's possible that the issue is related to your build or deployment process rather than your code itself.
To troubleshoot this issue, you could try the following steps:
-
Double-check your
runtimeConfigin yournuxt.config.jsfile to ensure it's correctly structured according to the latest Nuxt documentation. -
Try clearing your build cache and node_modules, then reinstalling dependencies and rebuilding.
-
If possible, try reproducing the issue in a local production build to determine if it's specific to your Coolify deployment.
- Consider creating a minimal reproduction of the issue, as suggested in the Nuxt bug reporting guidelines (https://nuxt.com/docs/community/reporting-bugs#create-a-minimal-reproduction), which could help identify if it's a Nuxt bug or specific to your project setup.