6

SystemJS appears to load rxjs modules without an issue but throws a 404 Not Found on the rxjs directory itself. All modules are the latest version and this only appears to be an issue on Windows, it works on osx.

GET http://localhost:8080/node_modules/rxjs/ 404 (Not Found)

Error: Error: XHR error (404 Not Found) XHR finished loading: GET " localhost:8080/node_modules/rxjs/Subject.js".

XHR finished loading: GET "localhost:8080/node_modules/rxjs/operator/toPromise.js".

Module loads & Error

<script>
    System.config({
        packages: {
            app: {
                format: 'register',
                defaultExtension: 'js',

            },
            'components':{ format: 'register' },
            'rxjs': {defaultExtension: 'js'}
        },
        map: {'app': '/components',
            'rxjs': '../node_modules/rxjs',
            },


    });
    System.import('components/notes.js')
            .then(null, console.error.bind(console));
</script>
+-- angular2@2.0.0-beta.9
+-- bootstrap@3.3.6
+-- es6-promise@3.0.2
+-- es6-shim@0.33.3
+-- jquery@2.2.1
+-- reflect-metadata@0.1.2
+-- rxjs@5.0.0-beta.2
+-- systemjs@0.19.24
| +-- es6-module-loader@0.17.11
| `-- when@3.7.7
+-- typescript@1.8.7
`-- zone.js@0.5.15
  `-- es6-promise@3.1.2

I fixed this, it seems the way I was importing rxjs in my .ts was deprecated:

changed from

import {Subject, Observable} from 'rxjs';

to:

import { Observable } from 'rxjs/Observable'; import { Subject } from 'rxjs/Subject'; import { map } from 'rxjs/operator/map';

Community
  • 1
  • 1
user2040800
  • 227
  • 4
  • 14
  • strange thing, but there are a lot of advices how to use rxjs library, but this is the only one that works! you really shoud use `from 'rxjs/Observable'` instead of `from 'rxjs'` – sinedsem Aug 12 '16 at 10:17
  • Just... wow... JS should be prohibited by law! – insan-e Jun 02 '17 at 09:11

2 Answers2

1

You shouldn't add rxjs special things in your system config. SystemJs supports node_modules module lookups by default.

basarat
  • 261,912
  • 58
  • 460
  • 511
  • I have it , but without it I get [more] load errors for the rxjs components as well as the error mentioned above. so added it as per this post: http://stackoverflow.com/questions/34318885/how-to-load-rxjs-and-zone-js-reflect-metadata-with-angular-2-beta-and-newer. – user2040800 Mar 10 '16 at 05:57
0

I too think that you're not needed to add rxjs in your System.config. It'll automatically take care of it. Like mentiond here in A2 5min Quick Start you just have to add <script src="node_modules/rxjs/bundles/Rx.js"></script> to your index.html and point your SystemJS to your main component , rest it'll take care the rest.

Manoj
  • 497
  • 7
  • 13