5

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?

tomab
  • 2,061
  • 5
  • 27
  • 38

3 Answers3

4

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.

Derviş Kayımbaşıoğlu
  • 28,492
  • 4
  • 50
  • 72
1

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

rcanpahali
  • 2,565
  • 2
  • 21
  • 37
  • Yeap, this is working. This is a solution, it got me unblocked. But on the long run is not users would want. – tomab Dec 12 '18 at 16:03
0

Package @aspnet/signalr 1.1.0 doesn't show this issue anymore. I cannot reproduce it on a new angular app.

tomab
  • 2,061
  • 5
  • 27
  • 38
  • 1
    Doesn't work for me with 1.1.0, same error, last working version is npm install @aspnet/signalr@1.0.4 – pingo Jan 27 '19 at 12:01
  • @pingo then your only chance is to fill an issue on the official repo and provide a sample app where the error is reproduced. – tomab Feb 03 '19 at 08:07