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

[Bug] glob is undefined #10

Closed
zakarialounes opened this issue Nov 15, 2023 · 2 comments
Closed

[Bug] glob is undefined #10

zakarialounes opened this issue Nov 15, 2023 · 2 comments

Comments

@zakarialounes
Copy link
Contributor

zakarialounes commented Nov 15, 2023

Problem

Using the latest nuxt-3vuex and nuxt version 3.8.1 generate the error below.
I think there is a problem with the multiple versions of @nuxt/kit present in my yarn.lock, but maybe I'm not the only one encountering this problem?

yarn run v1.22.19
$ nuxi dev ui
Nuxt 3.8.1 with Nitro 2.7.2                                                                                                                                                                              17:08:31
                                                                                                                                                                                                         17:08:31
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose


 ERROR  Cannot start nuxt:  Cannot read properties of undefined (reading 'sync')                                                                                                                         17:08:32

  at Object.vuexStores (node_modules/nuxt3-vuex-module/src/module.js:40:48)
  at setup (node_modules/nuxt3-vuex-module/src/module.js:99:16)
  at normalizedModule (node_modules/@nuxt/kit/dist/index.mjs:2141:38)
  at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2439:95)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:3696:7)
  at async NuxtDevServer._load (node_modules/nuxi/dist/chunks/dev2.mjs:255:5)
  at async NuxtDevServer.load (node_modules/nuxi/dist/chunks/dev2.mjs:187:7)
  at async NuxtDevServer.init (node_modules/nuxi/dist/chunks/dev2.mjs:182:5)
  at async Object.run (node_modules/nuxi/dist/chunks/dev-child.mjs:103:5)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.c6444792.mjs:1647:7)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.c6444792.mjs:1638:11)
  at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.c6444792.mjs:1770:7)

Solution

By replacing glob with fast-glob import in the module.js file, the error is no longer present and the program can continue.

GitHub Patch

index 6db7a0c..cb97078 100644
--- a/node_modules/nuxt3-vuex-module/src/module.js
+++ b/node_modules/nuxt3-vuex-module/src/module.js
@@ -1,7 +1,7 @@
 import { existsSync } from 'fs'
 import { resolve } from 'path'
 import { defineNuxtModule, addPlugin, addImports, addTemplate, createResolver } from '@nuxt/kit'
-import glob from 'glob'
+import glob from 'fast-glob'
 
 function addModule (storeModule, namespaces, alias) {
   if (!namespaces.length) {

diff --git a/package.json b/package.json
index c4fe8a0..482a86f 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,7 @@
   },
   "devDependencies": {
     "@types/mocha": "^9.1.1",
-    "glob": "^8.0.3",
+    "fast-glob": "^3.3.0",
     "nuxt": "^3.0.0"
   }
 }
@vedmant
Copy link
Owner

vedmant commented Nov 16, 2023

@zakarialounes Feel free to open a PR

@zakarialounes
Copy link
Contributor Author

Done on #11 🙏 @vedmant

@vedmant vedmant closed this as completed Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants