Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR on Webpack and TypeScript: cannot find module './NodeHttpClient'

I'm trying to set a SignalR client in an Angular app. There is Webpack which does the job. And TypeScript, of course.

Package.json is

{
  "private": true,
  "version": "0.0.0",
  "scripts": {
    "test": "karma start ClientApp/test/karma.conf.js"
  },
  "devDependencies" " { ... }
  "dependencies": {
    "@aspnet/signalr": "^1.1.0"
  }
}

The TypeScript code is:

import { HubConnectionBuilder } from '@aspnet/signalr';

@Component({
    selector: 'stream-details',
    templateUrl: './stream-details.component.html'
})
export class StreamDetailsComponent implements OnInit {
    @Input() summary: any;

constructor(private deviceService: StreamService) {
}

ngOnInit() {

    let connection = new HubConnectionBuilder()
        .withUrl('/streamingHub')
        .build()

    connection
        .start()
        .then(() => connection.stream('SubscribeToStream', 'stream123'));
}
}

When the app is running, the error is:

NodeInvocationException: Prerendering failed because of error: Error: Cannot find module './NodeHttpClient'

Why is not this NodeHttpClient.js file included? What do I miss?

like image 712
tomab Avatar asked Dec 11 '18 22:12

tomab


2 Answers

This prolem persists right now. There is also an issue on github. The issue is closed however according to my observations the problem still the case.

like image 149
Derviş Kayımbaşıoğlu Avatar answered Sep 19 '22 14:09

Derviş Kayımbaşıoğlu


Downgrading your @aspnet/signalr version to 1.0.0 solving the issue.

like image 33
rcanpahali Avatar answered Sep 20 '22 14:09

rcanpahali