tomab
tomab

Reputation: 2151

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?

Upvotes: 5

Views: 3775

Answers (3)

tomab
tomab

Reputation: 2151

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

Upvotes: 0

rcanpahali
rcanpahali

Reputation: 2643

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

Upvotes: 1

Derviş Kayımbaşıoğlu
Derviş Kayımbaşıoğlu

Reputation: 30605

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.

Upvotes: 4

Related Questions