nuxt-umami module not found during typecheck despite being installed

I'm running into an issue with nuxt-umami in my project. When running pnpm lint (which runs nuxt typecheck && eslint .), I'm getting this error: ERROR: Could not load nuxt-umami. Is it installed? However, nuxt-umami is definitely installed in my package.json:
{
"dependencies": {
"nuxt-umami": "^3.1.1"
// ... other deps
}
}
{
"dependencies": {
"nuxt-umami": "^3.1.1"
// ... other deps
}
}
My nuxt.config.ts has the proper configuration:
export default defineNuxtConfig({
modules: [
'nuxt-umami'
],
umami: {
id: "xxx",
host: "https://analytics.site.com",
autoTrack: true
}
})
export default defineNuxtConfig({
modules: [
'nuxt-umami'
],
umami: {
id: "xxx",
host: "https://analytics.site.com",
autoTrack: true
}
})
Any ideas what might be causing this? The module works fine during development, it's just the typecheck that's failing. Environment: Nuxt 3.15.4 nuxt-umami 3.1.1 pnpm
2 Replies
kapa.ai
kapa.ai2w ago
Hi @Sagar Kapoor. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information provided in the knowledge sources, there isn't a specific mention of the nuxt-umami module or the exact error you're encountering. However, I can provide some insights based on related issues and potential solutions for Nuxt 3 type-checking problems. The issue you're experiencing seems to be related to type-checking in Nuxt 3, specifically when running nuxt typecheck. This command is used to check types throughout your app using vue-tsc, as mentioned in the nuxi typecheck documentation. A few things to consider: 1. Recent Nuxt versions have had some issues with module resolution during type-checking. This was notably discussed in issue #30749, which mentions problems with finding modules after upgrading to Nuxt 3.15.3. 2. As a workaround, you could try adding nuxt-umami to the noExternal list in your nuxt.config.ts:
export default defineNuxtConfig({
// ... your existing config
vite: {
ssr: {
noExternal: ['nuxt-umami']
}
}
})

export default defineNuxtConfig({
// ... your existing config
vite: {
ssr: {
noExternal: ['nuxt-umami']
}
}
})

This solution was suggested for similar issues in the mentioned GitHub issue. 3. Make sure you have the latest versions of vue-tsc and typescript installed as dev dependencies, as mentioned in the TypeScript documentation for Nuxt. 4. If the problem persists, you might want to try clearing your node_modules and lockfile, then reinstalling dependencies:
rm -rf node_modules package-lock.json
pnpm install

rm -rf node_modules package-lock.json
pnpm install

5. If none of the above helps, it might be worth checking if there's an open issue in the nuxt-umami repository or creating a new one if there isn't. Remember that while the module works fine during development, type-checking is a separate process that can sometimes have different requirements or encounter different issues. If these suggestions don't resolve your issue, you may need to wait for further updates to Nuxt or nuxt-umami, or consider reaching out to the Nuxt community or nuxt-umami maintainers for more specific assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@565461230060306432> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?