As for now, there is NO WAY, you can install dependencies as peer-dependencies. You have to install then and manually move them to peerDependencies object in package.json
- I noticed that you update the question and my answer does not fulfill the context of the updated question.
OLD ANSWER
The automatic install of peer dependencies was removed with npm v3, this feature is aging added in npm v7.
So update your npm to version 7 or higher will solve most of the problems.
If You need to install dependency as a peer dependency.
To install peer dependency, you actually need to manually modify your package.json file.
For example, if you want to install angular's core component library as a peer dependency,
npm i @angular/core
This will add a property in the dependencies object.
"dependencies": {
"@angular/core": "^7.0.0"
}
- Move the installed package name to
peerDependencies key.
"peerDependencies": {
"@angular/core": "^7.0.0"
}
Extra:
if you need two versions of the same package then you modify the packge.json file like this,
"peerDependencies": {
"@angular/core": "^6.0.0"
"@angular/core": "^7.0.0"
}