3

Upon compilation, I got this error:

ERROR in node_modules/angular-in-memory-web-api/http-backend.service.d.ts(2,75): error TS2307: Cannot find module '@angular/http'. node_modules/angular-in-memory-web-api/http-in-memory-web-api.module.d.ts(2,28): error TS2307: Cannot find module '@angular/http'.

In package.json: "angular-in-memory-web-api": "^0.5.0"

I've deleted node_modules -> cleaned npm cache but still the same error

Alexz
  • 741
  • 1
  • 8
  • 20

5 Answers5

11

just npm install @angular/http . Even though its derpecated. It fixes the problem for the time being

numerical25
  • 10,524
  • 36
  • 130
  • 209
2

I also got the same error. Perhaps because I used -g while installing.

npm install -g angular-in-memory-web-api --save

Instead of the instructed

npm install angular-in-memory-web-api --save

Re-installing without

-g

solved the issue for me.

N Rai
  • 21
  • 2
0

So I've tried to import the latest in-memory web API module but it didn't see http/module, so right from here https://github.com/angular/in-memory-web-api/blob/master/http-client-backend.service.d.ts just copied the latest code, committed 9 days ago and it worked

Alexz
  • 741
  • 1
  • 8
  • 20
0

Happened to me because when I installed the package I was in the parent directory.

Make sure you are in the app directory before installing the package

Obay Abd-Algader
  • 1,079
  • 12
  • 25
0

I had to add dependency to package.json and run npm install -i and that worked for me.

Maciej Król
  • 1
  • 1
  • 2