代码之家  ›  专栏  ›  技术社区  ›  tomab

网页包和TypeScript上的信号器:找不到模块'./NodeHttpClient'

  •  2
  • tomab  · 技术社区  · 7 年前

    Package.json是

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

    类型脚本代码为:

    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'));
    }
    }
    

    应用程序运行时,错误为:

    NodeInvocationException:预呈现失败,原因是错误:错误:找不到模块“”/NodeHttpClient'

    为什么不包括这个NodeHttpClient.js文件?我错过了什么?

    3 回复  |  直到 7 年前
        1
  •  4
  •   Derviş Kayımbaşıoğlu    7 年前

    这个问题现在仍然存在。还有一个 issue

        2
  •  1
  •   rcanpahali    7 年前

    将@aspnet/signalr版本降级为1.0.0以解决此问题。

        3
  •  0
  •   tomab    7 年前