windicss / nuxt-windicss

🍃 Windi CSS for Nuxt ⚡
331 stars 24 forks source link

Cannot read properties of undefined (reading 'rootDir') #202

Open halilyuce opened 3 months ago

halilyuce commented 3 months ago

Describe the bug After doing the npm audit fix, my nuxt-windicss package was updated to "nuxt-windicss": "^2.0.15", and after that, when I added "nuxt-windicss" under modules in the nuxt.config.ts file, when I ran the npm commands (npm install etc) I get this error:

command failed
npm ERR! command sh -c nuxt prepare
npm ERR! I get the error ERROR Cannot read properties of undefined (reading 'rootDir')
at node_modules/nuxt-windicss/dist/module.mjs:74:24
npm ERR!   at normalizedModule (/Users/yuce/Documents/GitHub/portal/node_modules/@nuxt/kit/dist/index.mjs:2112:38)
npm ERR!   at async installModule (/Users/yuce/Documents/GitHub/portal/node_modules/@nuxt/kit/dist/index.mjs:2415:95)
npm ERR!   at async initNuxt (/Users/yuce/Documents/GitHub/portal/node_modules/nuxt/dist/index.mjs:4233:7)
npm ERR!   at async loadNuxt (/Users/yuce/Documents/GitHub/portal/node_modules/nuxt/dist/index.mjs:4331:5)
npm ERR!   at async loadNuxt (/Users/yuce/Documents/GitHub/portal/node_modules/@nuxt/kit/dist/index.mjs:2570:19)
npm ERR!   at async Object.run (/Users/yuce/Documents/GitHub/portal/node_modules/nuxi/dist/chunks/prepare.mjs:53:18)
npm ERR!   at async runCommand$1 (/Users/yuce/Documents/GitHub/portal/node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1648:16)
npm ERR!   at async runCommand$1 (/Users/yuce/Documents/GitHub/portal/node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1639:11)
npm ERR!   at async runMain$1 (/Users/yuce/Documents/GitHub/portal/node_modules/nuxi/dist/shared/nuxi.9edf0930.mjs:1777:7) 

my nuxt and vue versions:

"nuxt": "^3.11.2",
"vue": "3.4.21",

To Reproduce Steps to reproduce the behavior:

  1. Upgrade the nuxt-windicss package to the latest version
  2. Run npm install command
  3. See error

Expected behavior Commands run smoothly

Additional context The problem goes away when I remove the "nuxt-windicss" line from modules in nuxt.config.ts file but I need it.

halilyuce commented 3 months ago

@harlan-zw

npm finds audit problems in version 2.6.1 and as you see, when I run the "npm audit fix --force", it updates it to version 2.0.15 and in this version it causes the error

Cannot start nuxt: Cannot read properties of undefined (reading 'rootDir')

I hit a dead end.

image