electron-builder: Missing peer dependency: ajv@>=5.0.3-beta.0

  • Version: 15.1.1
  • Target: OS X

A recent version of electron-builder (^15.1.1) started logging peer dependency warnings on install:

npm WARN ajv-keywords@2.0.1-beta.1 requires a peer of ajv@>=5.0.3-beta.0 but none was installed.
─┬ electron-builder@15.1.1 
│ ├─┬ 7zip-bin@2.0.4 
│ │ └── 7zip-bin-mac@1.0.1 
│ ├─┬ UNMET PEER DEPENDENCY ajv@5.0.3-beta.0
│ │ ├── co@4.6.0 
│ │ └── json-stable-stringify@1.0.1 
│ ├── ajv-keywords@2.0.1-beta.1 
│ ├── bluebird-lst@1.0.1 
│ ├── chromium-pickle-js@0.2.0 
│ ├── cuint@0.2.2 
│ ├── electron-builder-core@13.6.0 
│ ├── electron-builder-http@15.0.1 
│ ├─┬ electron-builder-util@15.0.1 
│ │ ├── ini@1.3.4 
│ │ ├─┬ node-emoji@1.5.1 
│ │ │ └── string.prototype.codepointat@0.2.0 
│ │ ├─┬ source-map-support@0.4.11 
│ │ │ └── source-map@0.5.6 
│ │ ├── stat-mode@0.2.2 
│ │ └─┬ tunnel-agent@0.6.0 
│ │   └── safe-buffer@5.0.1 
│ ├─┬ electron-download-tf@4.0.0 
│ │ ├── fs-extra@2.0.0 
│ │ ├── minimist@1.2.0 
│ │ ├── path-exists@3.0.0 
│ │ └── sumchecker@2.0.1 
│ ├─┬ electron-macos-sign@1.6.0 
│ │ └── compare-version@0.1.2 
│ ├─┬ electron-publish@15.0.1 
│ │ ├── mime@1.3.4 
│ │ └── progress-ex@2.0.0 
│ ├─┬ fs-extra-p@4.0.2 
│ │ └── fs-extra@2.0.0 
│ ├── hosted-git-info@2.2.0 
│ ├─┬ is-ci@1.0.10 
│ │ └── ci-info@1.0.0 
│ ├── isbinaryfile@3.0.2 
│ ├─┬ js-yaml@3.8.2 
│ │ ├─┬ argparse@1.0.9 
│ │ │ └── sprintf-js@1.0.3 
│ │ └── esprima@3.1.3 
│ ├─┬ minimatch@3.0.3 
│ │ └─┬ brace-expansion@1.1.6 
│ │   ├── balanced-match@0.4.2 
│ │   └── concat-map@0.0.1 
│ ├── node-forge@0.7.0 
│ ├─┬ normalize-package-data@2.3.6 
│ │ ├─┬ is-builtin-module@1.0.0 
│ │ │ └── builtin-modules@1.1.1 
│ │ └─┬ validate-npm-package-license@3.0.1 
│ │   ├─┬ spdx-correct@1.0.2 
│ │   │ └── spdx-license-ids@1.2.2 
│ │   └── spdx-expression-parse@1.0.4 
│ ├─┬ parse-color@1.0.0 
│ │ └── color-convert@0.5.3 
│ ├─┬ plist@2.0.1 
│ │ ├── base64-js@1.1.2 
│ │ ├── xmlbuilder@8.2.2 
│ │ └── xmldom@0.1.27 
│ ├─┬ sanitize-filename@1.6.1 
│ │ └─┬ truncate-utf8-bytes@1.0.2 
│ │   └── utf8-byte-length@1.0.4 
│ ├── semver@5.3.0 
│ ├─┬ update-notifier@2.1.0 
│ │ ├─┬ boxen@1.0.0 
│ │ │ ├── ansi-align@1.1.0 
│ │ │ ├── camelcase@4.0.0 
│ │ │ ├── cli-boxes@1.0.0 
│ │ │ ├─┬ string-width@2.0.0 
│ │ │ │ └── is-fullwidth-code-point@2.0.0 
│ │ │ ├─┬ term-size@0.1.1 
│ │ │ │ └─┬ execa@0.4.0 
│ │ │ │   ├── cross-spawn-async@2.2.5 
│ │ │ │   ├── npm-run-path@1.0.0 
│ │ │ │   ├── path-key@1.0.0 
│ │ │ │   └── strip-eof@1.0.0 
│ │ │ └── widest-line@1.0.0 
│ │ ├─┬ configstore@3.0.0 
│ │ │ ├── dot-prop@4.1.1 
│ │ │ ├─┬ unique-string@1.0.0 
│ │ │ │ └── crypto-random-string@1.0.0 
│ │ │ └─┬ write-file-atomic@1.3.1 
│ │ │   └── slide@1.1.6 
│ │ ├── is-npm@1.0.0 
│ │ ├─┬ latest-version@3.0.0 
│ │ │ └─┬ package-json@3.1.0 
│ │ │   ├─┬ got@6.7.1 
│ │ │   │ ├─┬ create-error-class@3.0.2 
│ │ │   │ │ └── capture-stack-trace@1.0.0 
│ │ │   │ ├── duplexer3@0.1.4 
│ │ │   │ ├── get-stream@3.0.0 
│ │ │   │ ├── is-redirect@1.0.0 
│ │ │   │ ├── is-retry-allowed@1.1.0 
│ │ │   │ ├── lowercase-keys@1.0.0 
│ │ │   │ ├── timed-out@4.0.1 
│ │ │   │ ├── unzip-response@2.0.1 
│ │ │   │ └─┬ url-parse-lax@1.0.0 
│ │ │   │   └── prepend-http@1.0.4 
│ │ │   ├── registry-auth-token@3.1.0 
│ │ │   └── registry-url@3.1.0 
│ │ ├── lazy-req@2.0.0 
│ │ ├── semver-diff@2.1.0 
│ │ └── xdg-basedir@3.0.0 
│ ├─┬ uuid-1345@0.99.6 
│ │ └── macaddress@0.2.8 
│ └─┬ yargs@7.0.1 
│   ├── camelcase@3.0.0 
│   ├─┬ cliui@3.2.0 
│   │ └── wrap-ansi@2.1.0 
│   ├── decamelize@1.2.0 
│   ├── get-caller-file@1.0.2 
│   ├─┬ os-locale@1.4.0 
│   │ └─┬ lcid@1.0.0 
│   │   └── invert-kv@1.0.0 
│   ├─┬ read-pkg-up@1.0.1 
│   │ ├── find-up@1.1.2 
│   │ └─┬ read-pkg@1.1.0 
│   │   ├─┬ load-json-file@1.1.0 
│   │   │ └─┬ strip-bom@2.0.0 
│   │   │   └── is-utf8@0.2.1 
│   │   └── path-type@1.1.0 
│   ├── require-directory@2.1.1 
│   ├── require-main-filename@1.0.1 
│   ├── set-blocking@2.0.0 
│   ├─┬ string-width@1.0.2 
│   │ ├── code-point-at@1.1.0 
│   │ └── is-fullwidth-code-point@1.0.0 
│   ├── which-module@1.0.0 
│   ├── y18n@3.2.1 
│   └─┬ yargs-parser@5.0.0 
│     └── camelcase@3.0.0 

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 36 (23 by maintainers)

Commits related to this issue

Most upvoted comments

Because I’m from 2016 😃

npm shrinkwrap --dev.

Why not use yarn 😃?

Yeach… if you will insist, I will just copy ajv-keywords into project or republish as npm module.

@epoberezkin Are you aware of this issue?

ajv-keywords cannot depends on ajv, because *** npm in this case can install 2 deps (one for your project as direct dependency and another one for ajv-keywords if versions are different). Yarn in this case will always install 1 version. *** npm.

So, are you really want to use *** npm or you can migrate to reliable, fast and predictable yarn?

@bcomnes @salomvary Please see https://code.facebook.com/posts/1840075619545360 “Attempts at scaling the npm client”

https://github.com/npm/npm/issues/5135 shrinkwrap simply doesn’t support peer dependencies. I strongly suggest to not use npm and use yarn.

It is just a warning.

How does npm shrinkwrap printing out ERR! and exiting with non-zero status qualify as a warning? 😃

I’m still seeing this when installing electron-builder 15.3.0:

npm WARN ajv-keywords@2.0.1-beta.1 requires a peer of ajv@>=5.0.3-beta.0 but none was installed.

Npm shrinkwrap also fails hard on missing ajv@>=5.0.3-beta.0:

npm ERR! Please correct and try again.
npm ERR! peer invalid: ajv@>=5.0.3-beta.0, required by ajv-keywords@2.0.1-beta.1

@epoberezkin. That’s what I thought. I figured it had something to do with the changes npm made going from version 2 to 3 in which they use a different node_modules structure, and no longer automatically install peerDependencies like they used to. What I found odd was that electron-builder does include both ajv beta and ajv-keywords beta as dependencies, yet a package that uses electron-builder as well as some other package that uses ajv stable, reports an error (not warning), with npm list. Thanks for looking into this.

I don’t have the time or interest to follow this though with npm. I’m happy with what I’m doing now. Thanks for looking into this.

@salomvary If you insist and don’t want to use yarn — I can use stable version of ajv to make npm happy. Should I? Or you can migrate to yarn?

npm shrinkwrap is broken by design. If you really need “locks down the versions of a package’s dependencies” — use yarn instead of npm. Otherwise it is only “simulation” (sorry).

We just started using shrinkwrap at work for a project. Do you know any good writing or articles that expand on this? Would be nice to learn from others mistakes than learn for ourselves.

I’ve encountered the same issue on Ubuntu 16.04 building a very simple electron app.

npm --version
4.1.2
node --version
v7.7.2

The remaining problem is not the warning on npm install but an error and non-zero exit status on npm shrinkwrap --dev.

Steps to reproduce: https://gist.github.com/salomvary/b783d7934ec5351514678f4b0dac3274

Interestingly it is only reproducible if electron itself is present as a dependency. Without that things seem smooth (obviously not a solution:)