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?
npm no longer installs peer dependencies so you need to install them manually, just do an
npm install
on the needed deps, and then try to install the main one again.Reply to comment:
it's right in that message, it says which deps you're missing
So you need to
npm install angular angular-animate angular-aria angular-material angular-messages mdi
In my case all the dependencies were already there. Please update NPM in that case as it might have been crashed. It solved my problem. npm install -g npm
One of the most possible causes of this error could be that you have defined older version in your package.json. To solve this problem, change the versions in the package.json to match those npm is complaining about.
Once done, run npm install and voila!!.
This answer doesn’t apply all cases, but if you can’t solve the error by simply typing
npm install
, this steps might help.Let`s say you got this error.
This means you installed version 4.2.0 of packageA, but packageB@3.3.0 needs version 3.x.x of pakageA. (explanation of ^)
So you can resolve this error by downgrading packageA to 3.x.x, but usually you don`t want to downgrade the package.
Good news is that in some cases, packageB is just not keeping up with packageA and maintainer of packageB is trying hard to raise the peer dependency of packageA to 4.x.x.
In that case, you can check if there is a higher version of packageB that requires version 4.2.0 of packageA in the npm or github.
For example, Go to release page
Oftentimes you can find breaking change about dependency like this.
If you don’t find anything on release page, go to issue page and search issue by keyword like
peer
. You may find useful information.At this point, you have two options.
1) Upgrade to the version you want
2) Leave error for the time being, wait until stable version is released.
If you choose option1:
In many cases, the version does not have
latest
tag thus not stable. So you have to check what has changed in this update and make sure anything won`t break.If you choose option2:
If upgrade of pakageA from version 3 to 4 is trivial, or if maintainer of pakageB didn’t test version 4 of pakageA yet but says it should be no problem, you may consider leaving the error.
In both case, it is best to thoroughly test if it does not break anything.
Lastly, if you wanna know why you have to manually do such a thing, this link explains well.
The given answer wont always work. If it does not fix your issue. Make sure that you are also using the correct symbol in your
package.json
. This is very important to fix that headache. For example:So my typescript needs to be between 2.4.2 and 2.6 right?
So I changed my typescript library from using
"typescript": "^2.7"
to using"typescript": "^2.5"
. Seems correct?Wrong.
The
^
means that you are okay with npm using"typescript": "2.5"
or"2.6"
or"2.7"
etc...If you want to learn what the
^
and~
it mean see: What's the difference between tilde(~) and caret(^) in package.json?Also you have to make sure that the package exists. Maybe there is no
"typescript": "2.5.9"
look up the package numbers. To be really safe just remove the~
or the^
if you dont want to read what they mean.Today available Angular 2 rc.7, and I had a similar problem with
rxjs@5.0.0-beta.12
UNMET PEER DEPENDENCY.If you, like me, simply replaced
@angular/...rc.6
to@angular/...rc.7
- it's not enough. Because, for example,@angular/router
has norc.6
version.In this case, better review package.json in Quick start