Error with ajv/dist/compile/codegen Module After Installing @nuxtjs/eslint-module
sonsu95 opened this issue · 3 comments
Hello, I've recently set up a project using Nuxt 3 following these steps:
-
Installed Nuxt 3 using bunx nuxi@latest init .
-
Added ESLint and the related Nuxt module with bun add -D eslint @nuxtjs/eslint-module.
-
Configured the Nuxt config file as follows:
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
modules: ['@nuxtjs/eslint-module'],
});
However, when I run bun dev, I encounter the following error:
ERROR Cannot start nuxt: Cannot find module 'ajv/dist/compile/codegen'
This issue is a new occurrence; I didn't face it in previous setups. Temporarily, installing the ajv package directly seems to solve the problem, but I'm uncertain if this is the optimal solution. Does anyone have insights into the root cause of this issue?
Furthermore, if this issue is widespread, it might be prudent for the @nuxtjs/eslint-module to include the ajv package as a dependency. Your opinions on this matter would be greatly appreciated.
For additional context, a similar issue has been documented in an existing GitHub thread: #88
Thank you for your assistance.
If I use the npm dedupe --force
command, it resolves the issue. However, I'm still uncertain about why this problem occurs. Additionally, when I use Yarn and Bun.js, the problem persists.
Just install ajv@latest as dev dependencies can fix it.
I believe this is more like a package hoisting issue rather than a bug of this project.