question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@angular/http not marked as peer dependency

See original GitHub issue

Bug, feature request, or proposal:

Bug

What is the current behavior?

If @angular/http is installed but HttpModule not loaded in AppModule, compilation is OK and icons work well (the font is loaded locally so no server requests are needed).

But if @angular/http is uninstalled, Angular CLI compilation fails (and so I can’t even run my app) :

ERROR in/node_modules/@angular/material/typings/icon/icon-registry.d.ts (10,22): Cannot find module '@angular/http'.

ERROR in ./~/@angular/material/@angular/material.es5.js
Module not found: Error: Can't resolve '@angular/http' in '/node_modules/@angular/material/@angular'
 @ ./~/@angular/material/@angular/material.es5.js 20:0-37
 @ ./src/app/core/core.module.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

What is the use-case or motivation for changing an existing behavior?

Angular 4.3 introduced new HttpClient API, meaning we may not need anymore the previous Http API. And in this case, we should be able to not install @angular/http in the project, to have smaller bundles sizes.

What is the expected behavior?

Material icons seems to do hard imports of @angular/http even if it doesn’t need them. They should be remove when not necessary.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

@angular/cli 1.2.1 @angular/core 4.3.0 @angular/material beta.8

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:15
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

17reactions
aldo-romancommented, Aug 22, 2017

Any clue on this issue? We are running on the same problem 28 days later. Thanks guys!

PS: this is blocking issue given we cannot compile anymore. We had to install @angular/http and now have a larger bundle 😕

3reactions
jelbourncommented, Jul 25, 2017

The real issue here is that @angular/http should be a peerDependency of Angular Material; the library needs to import symbols from @angular/http to even compile.

We are likely going to switch to the new http client eventually (@angular/common/http), so this will likely be resolved then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incompatible peer dependencies found - upgrading Angular ...
I'm getting exactly the same incompatible-peer-dependencies list. Were you able to fix this? The answer you have marked is not clear for me....
Read more >
angular-in-memory-web-api peer dependency to angular 6 #1
I have angular 7 installed. npm install returns: npm WARN angular-in-memory-web-api@0.6.1 requires a peer of @angular/common@^6.0.0 but none ...
Read more >
npm Peer Dependencies - JavaScript inDepth
Peer Dependencies are used to specify that our package is compatible with a specific version of an npm package. Good examples are Angular...
Read more >
package.json - npm Docs
Marking a peer dependency as optional ensures npm will not emit a warning if the soy-milk package is not installed on the host....
Read more >
you must install peer dependencies yourself Code Example
npm WARN codelyzer@6.0.1 requires a peer of tslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found