Stackoverflow has plenty of questions about npm peerDependencies warnings, but none specifically address the best practices for actually handling the dependencies. Should we save them along with our dependencies and devDependencies? If so, what is the purpose of the peerDependencies in package.json?
After installing some other npm packages, I keep receiving warnings like:
npm WARN [email protected] requires a peer of slate@>=0.32.0 but none is installed. You must install peer dependencies yourself.
In response, I added a peerDependencies object in package.json and included what was being asked for:
...
"peerDependencies": {
"slate": "0.32.0"
},
...
I tried running npm i again, but the warning persisted.
The only way I could get rid of the warning was by including the peerDependency within devDependencies or dependencies, which I didn't want to do because it would clutter up my project's direct dependencies.
What is the correct approach to handling this situation?