1

I have been following the Angular Tour of Heros application and have reached the HTTP bit here: https://angular.io/docs/ts/latest/tutorial/toh-pt6.html.

All fine right up to the point where the tutorial starts telling me to delete my mock service and replace it with this:

import { InMemoryDbService } from 'angular-in-memory-web-api';

I ran npm and installed it from: https://github.com/angular/in-memory-web-api

and now it is coming back with a 404

GET http://localhost:5556/node_modules/angular-in-memory-web-api.js 404 (Not Found)

even though my linter doesn't produce compile errors in my IDE. Is there something else I need to do to configure this dependency that is currently missing in the tutorial?

Squiggs.
  • 4,299
  • 6
  • 49
  • 89
  • can you actually see `angular-in-memory-web-api.js` in your node modules folder? that path doesnt seem correct on your error – Bean0341 May 19 '17 at 15:59
  • also make sure you added the import for the module in your `app.module` file – Bean0341 May 19 '17 at 16:10
  • @Bean0341 - yeah, the path is wrong. But I don't know what to do to fix it. There is a angular-in-memory folder. – Squiggs. May 19 '17 at 17:01
  • are you using system.js or angular cli? – Bean0341 May 19 '17 at 17:27
  • @Bean0341 - I assume system.js. My project is forked from angular-seed. – Squiggs. May 19 '17 at 17:43
  • do you have a systemjs.config.js file in your project? or an angular-cli.json file? – Bean0341 May 19 '17 at 17:45
  • @Bean0341 - I have a Typescript system.config. i.e. system.config.ts not system.config.js – Squiggs. May 19 '17 at 17:58
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/144681/discussion-between-bean0341-and-paul). – Bean0341 May 19 '17 at 17:58
  • May be this link [Cannot find module './in-memory-data-service' in tour of heroes for Angular2 ](https://stackoverflow.com/questions/39877282/cannot-find-module-in-memory-data-service-in-tour-of-heroes-for-angular2/45372231#45372231) helps for your question. – ht13 Sep 20 '17 at 14:04

1 Answers1

0

Found the issue. I'm using Angular Seed. Which stores the configuration of systemjs.config in a separate file called seed.config.ts. Setting the path here: solves the issue for me after a fresh NPM start. The documentation is pretty weak at this point in how to get this running.

SYSTEM_CONFIG_DEV: any = {
    defaultJSExtensions: true,
    paths: {

  'angular-in-memory-web-api': 'node_modules/angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',

}
Squiggs.
  • 4,299
  • 6
  • 49
  • 89