Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript : How to resolve 'rxjs/Rx has no exported member 'SubscriptionLike'

Tags:

I'm trying to follow this example here https://www.youtube.com/watch?v=gxCu5TEmxXE, but when doing tsc -p, I get an error. Is there something I need to import?

ERROR:

node_modules/@angular/common/src/location/location.d.ts(1,10): error TS2305: Module '"...functions/node_modules/rxjs/Rx"' has no exported member 'SubscriptionLike'.

TS FILE

import "zone.js/dist/zone-node";
import * as functions from "firebase-functions";
import * as express from "express"
import { renderModuleFactory } from "@angular/platform-server"
import * as fs from "fs"

const document = fs.readFileSync(__dirname + "/dist-server/index.html", "utf8");
const AppServerModuleNgFactory = require(__dirname + "/dist-server/main.bundle");

const app = express();
app.get("**", (req, res) => {
    const url = req.path;
    renderModuleFactory(AppServerModuleNgFactory, { document, url }).then(html => {
        res.send(html);
    });
});
exports.post = functions.https.onRequest(app);

CONFIG

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es2015",
    "rootDir": ".",
    "outDir": "../functions"
  },
  "files": [
    "index.ts"
  ]
}
like image 975
Relm Avatar asked Mar 23 '18 09:03

Relm


1 Answers

I faced the same issue after following

Following this tutorial from djamware

After searching a lot, I have found that Rxjs package that is installed through instructions in this tutorial is not supported with Angular 6.

Angular 6 does not work with RxJS 5.5 but with RxJS 6.

npm i rxjs@6

Run the above command in cli and that should fix your problem. It did in my case.

like image 138
Nabil Mohammed Nalakath Avatar answered Sep 20 '22 08:09

Nabil Mohammed Nalakath