reactjs - npm build error: Cannot find module 'ajvdistcompilecodegen' - Stack Overflow

admin2025-04-25  2

When using thenpm run build command for a React project I'm working with I get the error above.

I've tried using the npm list ajv to see where the dependancy is being used and if I can understand anything from it, but I gotta be honest, I'm out of my depth here, node is not my area of expertise and the code is from a 3rd party that we outsource some development to. Here's the output, if anyone can guide me through what I'm seeing cause i don't understand much from it:

npm ERR! code ELSPROBLEMS
npm ERR! invalid: [email protected] base_directory\node_modules\ajv
[email protected] base_directory
`-- [email protected]
  +-- @pmmmwh/[email protected]
  | `-- [email protected]
  |   +-- [email protected]
  |   | `-- [email protected]
  |   +-- [email protected] invalid: "^3.5.2" from node_modules/file-loader/node_modules/schema-utils
  |   | `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords
  |   `-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  |   +-- [email protected]
  |   | `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords
  |   `-- [email protected] deduped
  +-- [email protected]
  | +-- @eslint/[email protected]
  | | `-- [email protected] deduped
  | `-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  |   `-- [email protected] deduped
  +-- [email protected]
  | `-- [email protected]
  |   `-- [email protected]
  |     +-- [email protected]
  |     | `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords, ">=8" from node_modules/@apideck/better-ajv-errors
  |     `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords
  +-- [email protected]
  | `-- [email protected]
  |   +-- [email protected]
  |   | `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords
  |   `-- [email protected] deduped
  `-- [email protected]
    `-- [email protected]
      +-- @apideck/[email protected]
      | `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords, ">=8" from node_modules/@apideck/better-ajv-errors
      `-- [email protected]

When using thenpm run build command for a React project I'm working with I get the error above.

I've tried using the npm list ajv to see where the dependancy is being used and if I can understand anything from it, but I gotta be honest, I'm out of my depth here, node is not my area of expertise and the code is from a 3rd party that we outsource some development to. Here's the output, if anyone can guide me through what I'm seeing cause i don't understand much from it:

npm ERR! code ELSPROBLEMS
npm ERR! invalid: [email protected] base_directory\node_modules\ajv
[email protected] base_directory
`-- [email protected]
  +-- @pmmmwh/[email protected]
  | `-- [email protected]
  |   +-- [email protected]
  |   | `-- [email protected]
  |   +-- [email protected] invalid: "^3.5.2" from node_modules/file-loader/node_modules/schema-utils
  |   | `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords
  |   `-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  |   +-- [email protected]
  |   | `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords
  |   `-- [email protected] deduped
  +-- [email protected]
  | +-- @eslint/[email protected]
  | | `-- [email protected] deduped
  | `-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  |   `-- [email protected] deduped
  +-- [email protected]
  | `-- [email protected]
  |   `-- [email protected]
  |     +-- [email protected]
  |     | `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords, ">=8" from node_modules/@apideck/better-ajv-errors
  |     `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords
  +-- [email protected]
  | `-- [email protected]
  |   +-- [email protected]
  |   | `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords
  |   `-- [email protected] deduped
  `-- [email protected]
    `-- [email protected]
      +-- @apideck/[email protected]
      | `-- [email protected] deduped invalid: "^8.8.2" from node_modules/ajv-keywords, ">=8" from node_modules/@apideck/better-ajv-errors
      `-- [email protected]
Share Improve this question asked Jan 16 at 13:18 Salvador AbateSalvador Abate 235 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

I had the similar problem. I used below steps to fix the problem. Hope this will fix your problem.

  1. npm install --save-dev ajv@^8
  2. npm audit fix --force
  3. npm start

enter image description here

enter image description here

转载请注明原文地址:http://anycun.com/QandA/1745530351a90827.html