How can solve npm UNMET PEER DEPENDENCY?

2019-01-03 12:07发布

I am on Windows 10, Node version 5.6.0 and npm version 3.6.0. Trying to install angular-material and mdi onto my working folder. npm install angular-material mdi gives me the following error messages:

+-- angular@1.5.0

+-- UNMET PEER DEPENDENCY angular-animate@^1.5.0

+-- UNMET PEER DEPENDENCY angular-aria@^1.5.0

+-- angular-material@1.0.6

+-- UNMET PEER DEPENDENCY angular-messages@^1.5.0 `-- mdi@1.4.57

npm WARN enoent ENOENT: no such file or directory, open
'C:\Users\xxxxx\Desktop\ngClassifieds\package.json' 

npm WARN angular-material@1.0.6 requires a peer of
angular-animate@^1.5.0 but none was installed. 

npm WARN angular-material@1.0.6 requires a peer of angular-aria@^1.5.0
but none was installed. 

npm WARN angular-material@1.0.6 requires a peer of
angular-messages@^1.5.0 but none was installed.

How do I resolve this to get AngularJS Material and MDI installed?

10条回答
仙女界的扛把子
2楼-- · 2019-01-03 12:59

Ok so i struggled for a long time trying to figure this out. Here is the nuclear option, for when you have exhausted all other ways..

When you are done, and it still works, import your actual code into this new project. Fix any compile errors the newer version of angular causes.

Thats what did it for me.. 1 hour of rework vs 6 hours of trying to figure out wtf was wrong.. wish i did it this way to start..

查看更多
Rolldiameter
3楼-- · 2019-01-03 13:09

npm-install-peers worked for me.

npm install -g npm-install-peers
查看更多
神经病院院长
4楼-- · 2019-01-03 13:10

you can resolve by installing the UNMET dependencies globally.

example : npm install -g @angular/common@4.4.6

install each one by one. its worked for me.

查看更多
一夜七次
5楼-- · 2019-01-03 13:13

UNMET PEER DEPENDENCY error is thrown when the dependencies of one or more modules specified in the package.json file is not met. Check the warnings carefully and update the package.json file with correct versions of dependencies.

Then run

rm -rf node_modules/
npm cache clean
npm install

This will install all the required dependencies correctly.

查看更多
登录 后发表回答