angular-cli: ajv@^6.0.0 is missing

npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

Versions

Angular CLI: 1.6.8
Node: 8.9.4
OS: darwin x64
Angular: 4.4.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, tsc-wrapped

@angular/cdk: 2.0.0-beta.12
@angular/cli: 1.6.8
@angular/material: 2.0.0-beta.12
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.3.4
webpack: 3.10.0

Repro steps

  • Step 1

npm i -g @angular/cli

  • Step 2

npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

Observed behavior

long@LONG-MBP  ~/Developer/ngx   LONG-jenkins-submodule  npm update @angular/cli
npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

+ @angular/cli@1.7.0
added 34 packages, removed 139 packages, updated 45 packages and moved 3 packages in 18.928s

Desired behavior

angular installed without any error or warning

Mention any other details that might be useful (optional)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 17 (1 by maintainers)

Commits related to this issue

Most upvoted comments

I solved this issue by doing the following after running npm i -g @angular/cli:

At this point npm ls -g --depth 0 will have errors in regard to peer dependencies for the ajv package. Let’s go to where the @angular/cli package is installed:

cd $(npm config get prefix)
cd lib/node_modules/@angular/cli

Run this command just for reference:

find . -name 'ajv' -type d

Now for the fix, run this:

npm i ajv@^6.0.0

This will in allow the ajv-keywords package to resolve its peer dependencies AND also patch up any packages in subdirectories that depend on a version of ajv (ie. it installs ajv@5.5.2 for packages that need ajv@~5.5.1 or ajv@^5.0.0 in their respective directories). npm ls -g --depth 0 should be working now without peer dependency errors. To see the results of this patching, run the find command again:

find . -name 'ajv' -type d

To check the versions, run:

find . -name 'ajv' -type d -exec grep '"version":' {}/package.json \;

I’ve solved it by deleting my package-lock.json and running npm install again.

I am also seeing this

npm i -g ajv@^6.0.0 does not fix this issue

me too have the same problem and when i tried to install ajv with the command :npm install ajv i get this npm WARN saveError ENOENT: no such file or directory, open ‘C:\WINDOWS\system32\package.json’ npm WARN enoent ENOENT: no such file or directory, open ‘C:\WINDOWS\system32\package.json’ npm WARN system32 No description npm WARN system32 No repository field. npm WARN system32 No README data npm WARN system32 No license field.

  • ajv@6.1.1 updated 1 package in 3.14s

Having this error while installing google-map-react through npm.

ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“ia32”})