Ajv: npm ERR! peer dep missing: ajv@^6.0.0, required by [email protected]

Created on 18 Feb 2018  Β·  23Comments  Β·  Source: ajv-validator/ajv

What version of Ajv are you using? Does the issue happen if you use the latest version?

Ajv options object


JSON Schema


Sample data


Your code


Validation result, data AFTER validation, error messages


What results did you expect?

Are you going to resolve the issue?
a.txt

dependency

Most helpful comment

This is fixed by adding ajv in your project. The problem is almost certainly with npm itself.

All 23 comments

Most likely, the issue title explains the problem. What is the output of npm ls? Try removing package-lock.json and reinstalling node_modules.

Hello, I have uploaded the "npm ls" output, please see the a.txt file
a.txt
. I have tried on maccOS, ununtu 16.04. and always get the same result,
...........
npm ERR! peer dep missing: ajv@^6.0.0, required by [email protected]
npm ERR! peer dep missing: ajv@^6.0.0, required by [email protected]

In your output the error is in the chain:

@angular/cli -> cache-loader -> [email protected] -> ajv-keywords

[email protected] depends on ajv@^6.1.0, I don't know why it was not installed (it's not in the output of npm ls).

Did you try removing everything and re-installing?
Which version of node.js you are using?
Does it change if you try older/newer version of node.js?

This happened when installing Angular/CLI, if downgrade the following 3 packages, seems to ok
ajv-keywords v2.1.1,
schema-utils: v0.4.3,
webpack: v0.4.3 ,
but when you run "ng new NewProject", the problem comes again, you have to manualy downgrade everytime when create new project.

git clone ... && npm install works ok for me - it doesn't show the error above.
If an issue happens during ng new NewProject I think it should be reported to @angular/cli.
Closing it here.

For reference, I think this might be an npm bug - seeing this problem with [email protected] and [email protected], but not with [email protected] or [email protected].

@dputtick thanks, was on NPM 5.5.1 receiving this error, moving to [email protected] removed the ajv-keywords WARN.

EDIT: Sorry must of been in placebo land, still happening. πŸ‘Ž

@dputtick Weird, I still get the WARN on [email protected] and I even updated to [email protected] and still get it.

same error for node 8.9.4 and npm 5.7.1

Same error for node 9.8.0 and npm 5.7.1

...
β”‚ β”œβ”€β”€ UNMET PEER DEPENDENCY [email protected]
β”‚ β”œβ”€β”€ [email protected]
...
npm ERR! peer dep missing: ajv@^6.0.0, required by [email protected]

This is fixed by adding ajv in your project. The problem is almost certainly with npm itself.

Is the ajv required by every package? Cause I'm using react and everytime I install any package it tell me that ajv-keywords requires ajv to be installed. Annoying!!!!!

Hello everyone, if you are experiencing this issue (npm ERR! peer dep missing: ajv@^6.0.0, required by [email protected]) after using create-react-app and trying to npm install any package, it is because ajv-keywords has devDependencies and peerDependencies on ajv ^6.0.0, but what is installed (assuming as part of the create-react-app process) is ajv 5.5.2. So "A" way to resolve (work around) is to change those two lines in the ajv-keywords package.json from 6.0.0 to 5.5.2. I did that and now I can npm install any package in my create-react-app . Hope this helps...

@eholland7080 the correct way to resolve it is to either upgrade ajv to 6.x or downgrade ajv-keywords to 2.x, as otherwise they are not fully compatible (even if they can work in some cases). I wonder what tool has ajv 5.x and ajv-keywords 3.x in its dependencies. Can it be caused by eslint still using 5.x and webpack using 6.x (and ajv-keywords 3.x)? If so, it's definitely npm issue, although can be fixed by upgrading eslint...

@epoberezkin thank you! how would you recommend as to the best way to upgrade ajv to 6.x? I understand how I would do it if I had installed ajv myself using npm install. not sure how I should do it if ajv was installed automatically by a tool like react-create-app. learning a lot but still a little new so any direction / instructions you can give would be greatly appreciated. thank you...

@silencieuxle are you still seeing this issue when using react? if you're not, what did you do to fix?

We suggest that you begin by typing:

cd my-app
npm start

Happy hacking!
Erics-MacBook-Pro:prototype ericholland$ cd my-app/
Erics-MacBook-Pro:my-app ericholland$ npm list --depth 0
[email protected] /Users/ericholland/Documents/work/development/react/prototype/my-app
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
└── [email protected]

npm ERR! peer dep missing: ajv@^6.0.0, required by [email protected]
Erics-MacBook-Pro:my-app ericholland$

See the second part of the answer in https://github.com/eslint/eslint/pull/9856#issuecomment-377694098

According to it it’s an npm bug.

Found the npm issue: npm/npm#19877 (specifically this comment). Hope this helps!

@epoberezkin thank you! thats good information there. based on those comments looks like it is a problem with npm 3+ ? so not sure what to do in the interim between now and when the npm folks fix the issue.

@eholland7080 is it a blocking issue? Can't you just use some command line parameter to ignore the message? I'm not sure npm is going to fix it any time soon...

@epoberezkin using yarn now and the specific issue above does not occur.
thank you
Eric

Was this page helpful?
0 / 5 - 0 ratings