Angular-cli: ajv@^6.0.0 is missing

Created on 20 Feb 2018  Â·  17Comments  Â·  Source: angular/angular-cli

npm WARN [email protected] 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 [email protected] 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 [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

+ @angular/[email protected]
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)

critical regression bufix

Most helpful comment

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 [email protected] 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 \;

All 17 comments

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.

Same issue :S

I am also seeing this

+1

npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
$ npm i ajv

and when I install something, it always remove flex-layout)

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

same here, a simple fix after the npm hints doesn't work out:

$sudo npm install -g ajv@^6.0.0
+ [email protected]
updated 1 package in 0.862s
$sudo npm install -g [email protected] 
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

+ [email protected]
updated 1 package in 0.587s

npm install -g @angular/cli@latest
/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@angular/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ @angular/[email protected]
updated 1 package in 26.231s

Same issue. Please fix! @angular/[email protected]

When I execute npm list -g --depth=0 this error is listed twice:

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]

Installing [email protected] does NOT help.

Heya I've been looking at this problem and I'm not too sure what to make of it.

At the moment I think this is a npm bug.

I added a reproduction in https://github.com/filipesilva/ajv-peerdep-issue and reported it in https://github.com/npm/npm/issues/19877.

It is related to https://github.com/webpack-contrib/schema-utils/issues/23.

I'm not looking at ways to alleviate the problem on Angular CLI itself.

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

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 [email protected] 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'm not fully trusting [email protected]. It just left a whole bunch of missing package errors when used with the angular cli ng new test then npm ls --depth 0 (after cd into test). So I downgraded with npm i -g npm@~5.5.0 (which installed [email protected]). Then after another ng new test, running npm ls --depth 0 only reported the peer dependency errors. Now installing the peer dependency works as it should:

npm i ajv@^6.0.0 (from the project directory, 'test' in my example)

Note that this is for the local install of @angular/cli, whereas my above fix was regarding a global install of @angular/cli.

I'm getting this with semantic ui
I see that this issue is recent so I think it might be due to recent change with npm

Same issue here when installing standard via npm i -D standard

edit

Can confirm @Sixophrenia's comment - no issues when installing with yarn

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

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

having the same issue @angular/core": "~6.0.0" is not being installed for me in my node_modules package.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings