RxJS root directory SystemJS not found

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

GET http: // localhost: 8080 / node_modules / rxjs / 404 (not found)

Error: Error: XHR error (404 not found) XHR completed loading: GET "localhost: 8080 / node_modules / rxjs / Subject.js".

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

Module loading and 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 looks like I imported rxjs in my .ts, was deprecated:

changed from

import {Subject, Observable} from 'rxjs';

in

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

+5
source share
2 answers

I also think that you do not need to add rxjs to your System.config. He will automatically take care of this. As mentioned here in A2 5min Quick Start , you just need to add <script src="node_modules/rxjs/bundles/Rx.js"></script> to your index.html and point SystemJS to your main component, take a rest it will take care everything else.

0
source

You should not add rxjs special things to your system configuration. SystemJs, by default, supports searching for the module node_modules .

+1
source

Source: https://habr.com/ru/post/1244788/


All Articles