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,039
  • 9
  • 18
Ole
  • 36,095
  • 47
  • 151
  • 295

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.

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
  • 19,347
  • 24
  • 82
  • 121