0

npm install outputs the following warning:

npm WARN nswag@11.11.3 requires a peer of npm@>=3.10.8 but none is installed. You must install peer dependencies yourself.

npm -v outputs 5.5.1

Why is npm complaining about the missing peer dependency?

This question isn't a duplicate of What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?. That question doesn't even mention engines and doesn't explain that peerDependencies are not searched among global packages.

hectorct
  • 3,335
  • 1
  • 22
  • 40
  • Possible duplicate of [What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?](https://stackoverflow.com/questions/18875674/whats-the-difference-between-dependencies-devdependencies-and-peerdependencies) – Andrea Carraro Nov 22 '17 at 21:19

1 Answers1

0

Peer dependencies are not searched among global packages (https://github.com/npm/npm/issues/9857). npm should be installed locally for the peer dependency to be satisfied.

In this case, if the nswag package does not need the npm package installed locally, it should list it in engines instead of in peerDependencies.

hectorct
  • 3,335
  • 1
  • 22
  • 40