0

Looking through the documentation I see -S, -O, -D etc. options for installing dependencies, but I don't see a flag for installing to the peer dependency block.

Does NPM have a flag for installing to peer dependencies?

CoryCoolguy
  • 1,065
  • 8
  • 18
Ole
  • 41,793
  • 59
  • 191
  • 359

2 Answers2

0

Per https://blog.npmjs.org/post/110924823920/npm-weekly-5,

Peer dependencies won't be automatically installed and you must install them manually.

If you want to save peer dependencies for your project, install with the --peer flag.

Carter
  • 3
  • 3
0

No, there is no CLI flag to install as a peer dependency.

You will need to manually edit package.json to add a property peerDependencies.

{
  "name": "my-package",
  "version": "1.0.0",
  "peerDependencies": {
    "cuid": "^2.1.0"
  }
}

https://docs.npmjs.com/files/package.json#peerdependencies

styfle
  • 22,361
  • 27
  • 86
  • 128