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

5 Answers 5

11

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

Sign up to request clarification or add additional context in comments.

Comments

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.

1 Comment

for me too but I remember to install in project directory
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

Comments

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

Comments

0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.