0

I am facing this error while I am trying to import directive in component

GET http://localhost:3000/@angular/core 404 Error: Error: XHR error (404 Not Found) loading http://localhost:3000/@angular/core(…)

Can someone help me on this?

Maverick
  • 59
  • 2
  • 11

2 Answers2

1

You didn't configure the @angular/core module into your SystemJS configuration.

With RC versions, there is not yet bundled files for Angular2. This means that you need to configure the framework modules like below:

var map = {
  'app': 'app',
  'rxjs': 'node_modules/rxjs',
  'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
  '@angular': 'node_modules/@angular'
};

var packages = {
  'app': { main: 'main.js',  defaultExtension: 'js' },
  'rxjs': { defaultExtension: 'js' },
  'angular2-in-memory-web-api': { defaultExtension: 'js' },
};

var packageNames = [
  '@angular/common',
  '@angular/compiler',
  '@angular/core', // <--------
  '@angular/http',
  '@angular/platform-browser',
  '@angular/platform-browser-dynamic',
  '@angular/router',
  '@angular/router-deprecated',
  '@angular/testing',
  '@angular/upgrade',
];

packageNames.forEach(function(pkgName) {
  packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
});

var config = {
  map: map,
  packages: packages
}

System.config(config);

This way, you will be able to import the @angular/core module.

Thierry Templier
  • 198,364
  • 44
  • 396
  • 360
0

change this
import { InMemoryBackendService, SEED_DATA } from 'angular2-in-memory-web-api';
to ->>
import { InMemoryBackendService, SEED_DATA } from 'angular2-in-memory-web-api/in-memory-backend.service';

in your main.ts

AutoMEta
  • 1,339
  • 6
  • 22
  • 35