I tried to run a project downloaded from github. Unfortunately, during npm install
the following warnings were shown. I tried to change the version based on thi
For each error of the form:
npm WARN {something} requires a peer of {other thing} but none is installed. You must install peer dependencies yourself.
You should:
$ npm install --save-dev "{other thing}"
Note: The quotes are needed if the {other thing}
has spaces, like in this example:
npm WARN rollup-plugin-uglify@6.0.3 requires a peer of rollup@>=0.66.0 <2 but none was installed.
Resolved with:
$ npm install --save-dev "rollup@>=0.66.0 <2"
npm install -g npm-install-peers
it will add all the missing peers and remove all the error
In my case following commands worked for me:
sudo npm cache clean --force
sudo npm install -g npm
sudo apt install libssl1.0-dev
sudo apt install nodejs-dev
sudo apt install node-gyp
sudo apt install npm
After that if you are facing "Cannot find module 'bcrypt' then for that you can resolve this one with below commands:
npm install node-gyp -g
npm install bcrypt -g
npm install bcrypt --save
Hope it will work for you as well.
Had the same issue installing angular material CDK:
npm install --save @angular/material @angular/cdk @angular/animations
Adding -dev
like below worked for me:
npm install --save-dev @angular/material @angular/cdk @angular/animations
"A requires a peer of B but none was installed". Consider it as "A requires one of B's peers but that peer was not installed and we're not telling you which of B's peers you need."
The automatic installation of peer dependencies was explicitly removed with npm 3.
NPM Blog
Release notes of v3
So you cannot install peer dependencies automatically with npm 3 and upwards.
Updated Solution:
Use following for each peer dependency to install that and remove the error
npm install --save-dev xxxxx
Deprecated Solution:
You can use npm-install-peers to find and install required peer dependencies.
npm install -g npm-install-peers
npm-install-peers
If you are getting this error after updating any package's version then remove node_modules
directory and reinstall packages by npm install
or npm cache clean
and npm install
.
total edge case here: I had this issue installing an Arch AUR PKGBUILD file manually. In my case I needed to delete the 'pkg', 'src' and 'node_modules' folders, then it built fine without this npm error.