小编har*_*511的帖子

GRPC 客户端错误:14 UNAVAILABLE:无法连接到所有地址

我尝试使用下面的代码测试我的 grpc 客户端连接。我有 .net core grpc 服务器并使用 Node js grpc 客户端进行连接。但出现“无法连接到所有地址”错误。但能够将 .net grpc 服务器连接到 .net grpc 客户端。非常感谢任何帮助。

不确定我是否遗漏了下面 grpc 客户端代码中的任何内容。

'use strict';
//Same as the other projects we import fs for reading documents, in this case employees.js json
const fs = require('fs');

//Importing GRPC and the proto loader
const grpc = require('grpc');
const loader = require('@grpc/proto-loader');



//reads the proto
const packageDefinition = loader.loadSync('Repository.proto', {
  keepCase: false,
  longs: String,
  enums: String, 
  defaults: true,
  oneofs: true
});



//Loads the proto file to …
Run Code Online (Sandbox Code Playgroud)

javascript node.js grpc grpc-web grpc-node

6
推荐指数
1
解决办法
2万
查看次数

找不到模块:错误:无法使用Webpack解决'fs'

嗨,我在我的应用程序中使用套接字io。这需要fs。当我尝试使用下面的webpack配置捆绑我的JavaScript时。即时通讯收到错误无法解决“ FS”。

Module not found: Error: Can't resolve 'fs' in 'my application path/node_modules/socket.io/lib'
Run Code Online (Sandbox Code Playgroud)

我通过添加target:'node'和找到了node:{fs:'empty'}。这个问题解决了。

但是sass-loader中存在一个问题。低于错误。

ERROR in javascript/bundle.js from UglifyJs
Unexpected token: name (zlibLimiter) [javascript/bundle.js:60019,4]
Child extract-text-webpack-plugin ../../../node_modules/extract-text-webpack-plugin/dist ../../../node_modules/css-loader/index.js??ref--2-2!../../../node_modules/sass-loader/lib/loader.js!s
Run Code Online (Sandbox Code Playgroud)

运行应用程序而忽略上述错误。低于错误。

external "crypto":1 Uncaught ReferenceError: require is not defined
    at Object.__decorate (external "crypto":1)
    at __webpack_require__ (bootstrap 93620a17882f7a2aa1d3:19)
    at Object.byteToHex (rng.js:4)
    at __webpack_require__ (bootstrap 93620a17882f7a2aa1d3:19)
Run Code Online (Sandbox Code Playgroud)

以下是我的webpack配置和版本。有人可以帮我解决这个问题吗?

“ webpack”:“〜3.6.0”,npm -v 5.8.0节点-v v8.4.0

const webpack = require('webpack');
const env = process.env.NODE_ENV;
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
const …
Run Code Online (Sandbox Code Playgroud)

sass node.js webpack-file-loader webpack-3

5
推荐指数
2
解决办法
8696
查看次数