Devtool referring to other node version

Nuxt 3.
➜ client git:(800-tk_205) ✗ bun -v
1.1.34
➜ client git:(800-tk_205) ✗ node -v
v20.8.1
➜ client git:(800-tk_205) ✗ nvm use 20
Now using node v20.8.1 (npm v10.1.0)
➜ client git:(800-tk_205) ✗ rm -rf bun.lockb package-lock.json node_modules .nuxt
➜ client git:(800-tk_205) ✗ bun install
[0.39ms] ".env"
bun install v1.1.34 (5e5e7c60)

$ nuxt prepare
ℹ Using Tailwind CSS from ~/assets/css/tailwind.css nuxt:tailwindcss 16:19:10

ERROR Nuxt module should be a function: /Users/ashcslmn/.nvm/versions/node/v16.17.1/lib/node_modules/@nuxt/devtools/module.cjs 16:19:11

at loadNuxtModuleInstance (node_modules/@nuxt/kit/dist/index.mjs:2460:11)
at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2389:47)
at async initNuxt (node_modules/nuxt/dist/index.mjs:4669:5)
at async loadNuxt (node_modules/nuxt/dist/index.mjs:4839:5)
at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:2627:19)
at async Object.run (node_modules/nuxi/dist/chunks/prepare.mjs:61:18)
at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1648:16)
at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1639:11)
at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1777:7)



ERROR Nuxt module should be a function: /Users/ashcslmn/.nvm/versions/node/v16.17.1/lib/node_modules/@nuxt/devtools/module.cjs 16:19:11

error: postinstall script from "nuxt-app" exited with 1
➜ client git:(800-tk_205) ✗
➜ client git:(800-tk_205) ✗ bun -v
1.1.34
➜ client git:(800-tk_205) ✗ node -v
v20.8.1
➜ client git:(800-tk_205) ✗ nvm use 20
Now using node v20.8.1 (npm v10.1.0)
➜ client git:(800-tk_205) ✗ rm -rf bun.lockb package-lock.json node_modules .nuxt
➜ client git:(800-tk_205) ✗ bun install
[0.39ms] ".env"
bun install v1.1.34 (5e5e7c60)

$ nuxt prepare
ℹ Using Tailwind CSS from ~/assets/css/tailwind.css nuxt:tailwindcss 16:19:10

ERROR Nuxt module should be a function: /Users/ashcslmn/.nvm/versions/node/v16.17.1/lib/node_modules/@nuxt/devtools/module.cjs 16:19:11

at loadNuxtModuleInstance (node_modules/@nuxt/kit/dist/index.mjs:2460:11)
at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2389:47)
at async initNuxt (node_modules/nuxt/dist/index.mjs:4669:5)
at async loadNuxt (node_modules/nuxt/dist/index.mjs:4839:5)
at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:2627:19)
at async Object.run (node_modules/nuxi/dist/chunks/prepare.mjs:61:18)
at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1648:16)
at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1639:11)
at async runMain$1 (node_modules/nuxi/dist/shared/nuxi.bd0a2fa0.mjs:1777:7)



ERROR Nuxt module should be a function: /Users/ashcslmn/.nvm/versions/node/v16.17.1/lib/node_modules/@nuxt/devtools/module.cjs 16:19:11

error: postinstall script from "nuxt-app" exited with 1
➜ client git:(800-tk_205) ✗
steps above, I am trying to install howerver the devtools is always referring to global node js.
Any idea on how to fix it? TIA
2 Replies
kapa.ai
kapa.ai2w ago
Hi @Ashley Solomon. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The issue you're experiencing seems to be related to Nuxt DevTools referencing a global Node.js installation instead of your project's local Node.js version. This can happen due to how Nuxt DevTools is installed and configured. Let's try to resolve this issue step by step: 1. First, make sure you're using the latest version of Nuxt. You can update it by modifying your package.json file or running:
bun add nuxt@latest

bun add nuxt@latest

2. Instead of relying on the global installation of Nuxt DevTools, you should install it locally in your project. Add it to your project's dependencies by running:
bun add -D @nuxt/devtools

bun add -D @nuxt/devtools

3. After installing it locally, update your nuxt.config.ts file to enable DevTools:
export default defineNuxtConfig({
devtools: { enabled: true }
})

export default defineNuxtConfig({
devtools: { enabled: true }
})

This approach is recommended in the Nuxt DevTools documentation (https://devtools.nuxt.com/guide/getting-started#auto-install). 4. If you're still experiencing issues, you can try clearing the Nuxt cache:
bun run nuxt cleanup

bun run nuxt cleanup

5. If the problem persists, you might need to check your .nuxtrc file in your home directory. As mentioned in a GitHub issue comment (https://github.com/nuxt/nuxt/issues/19682), sometimes this file can cause conflicts. If it exists, check its contents and remove any lines referencing specific Node.js versions or paths. 6. As a last resort, you can try using the edge release channel of Nuxt DevTools. Update your package.json as follows:
{
"devDependencies": {
"@nuxt/devtools": "npm:@nuxt/devtools-edge@latest"
}
}

{
"devDependencies": {
"@nuxt/devtools": "npm:@nuxt/devtools-edge@latest"
}
}

This approach is described in the Nuxt DevTools documentation (https://devtools.nuxt.com/guide/getting-started#edge-release-channel). After making these changes, remove the node_modules folder and the lock file, then run bun install again. If you're still encountering issues after trying these steps, it might be worth checking if there are any conflicts with other global Node.js installations or NVM configurations on your system. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@844095436587270165> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Want results from more Discord servers?
Add your server