Jan Nielsen
Jan Nielsen

Reputation: 11799

"RxJS could not find any global context"

My Angular 4 application build via Angular CLI stopped working, apparently out of the blue:

ng --version` 

results in the following error:

RxJS could not find any global context (window, self, global)
Error: RxJS could not find any global context (window, self, global)
    at /home/jan/.nvm/versions/node/v7.10.0/lib/node_modules/@angular/cli/node_modules/rxjs/util/root.js:15:11
    at Object.<anonymous> (/home/jan/.nvm/versions/node/v7.10.0/lib/node_modules/@angular/cli/node_modules/rxjs/util/root.js:16:3)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/jan/.nvm/versions/node/v7.10.0/lib/node_modules/@angular/cli/node_modules/rxjs/Observable.js:2:14)

Upvotes: 2

Views: 445

Answers (2)

Jan Nielsen
Jan Nielsen

Reputation: 11799

Downgrade RxJS to 5.1.1; in package.json remove the caret (^):

"rxjs": "5.1.1",

and then

npm install

Update May 10, 2017:

Last night, the RxJS project removed the offending 5.3.2 release and released 5.3.3 which addresses this problem so, you can now use a caret dependency, again, e.g.:

"rxjs": "^5.1",

Explanation:

The RxJS project released 5.3.2 on May 2 which has a backwards compatibility issue. This caused any project with a caret dependency on RxJS 5 to fail. The offending 5.3.2 RxJS release was removed on May 9 and replaced with a fixed 5.3.3 release so caret dependencies now work, again.

Upvotes: 3

Poul Kruijt
Poul Kruijt

Reputation: 71911

The problem was a broken commit by rxjs. Version 5.3.2 has been removed. Just update rxjs again to the latest version, and you'll be good to go again. Check the changelog

Upvotes: 1

Related Questions