繁体   English   中英

无法验证第一个证书(grpc /节点)

[英]Unable to verify the first certificate (grpc/node)

在某些背景下,我将跟随教程,尝试使节点示例正常工作。

我已经下载了该文件夹,将其CD到目录中,并尝试运行npm install

我得到以下堆栈跟踪。

npm WARN package.json grpc-examples@0.1.0 No repository field.
npm WARN package.json grpc-examples@0.1.0 No license field.
\
> grpc@1.12.2 install /tmp/grpc/examples/node/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Tried to download(400): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.12.2/node-v46-linux-x64-glibc.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for grpc@1.12.2 and node@4.5.0 (node-v46 ABI, glibc) (falling back to source compile with node-gyp) 
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: unable to verify the first certificate
gyp ERR! stack     at Error (native)
gyp ERR! stack     at TLSSocket.<anonymous> (_tls_wrap.js:1022:38)
gyp ERR! stack     at emitNone (events.js:67:13)
gyp ERR! stack     at TLSSocket.emit (events.js:166:7)
gyp ERR! stack     at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._finishInit (_tls_wrap.js:586:8)
gyp ERR! stack     at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ssl.onhandshakedone (_tls_wrap.js:428:38)
gyp ERR! System Linux 4.8.13-100.fc23.x86_64
gyp ERR! command "/home/nbkiq0w/.nvm/versions/node/v4.5.0/bin/node" "/home/nbkiq0w/.nvm/versions/node/v4.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--libr$ry=static_library" "--module=/tmp/grpc/examples/node/node_modules/grpc/src/node/extension_binary/node-v46-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/tmp/grpc/examples/node/node_mo$ules/grpc/src/node/extension_binary/node-v46-linux-x64-glibc" "--node_abi_napi=node-v46"

堆栈跟踪还有更多内容,但是我认为这很重要。

Unable to verify the first certificate

在这里似乎相关。

我在Google上搜索了一下,发现 ,这似乎可以解决我的问题。 我修改了示例源代码,

examples/node/dynamic_codegen/greeter_server.js

因此,现在将以下内容添加到现有文件的顶部。

var rootCas = require('ssl-root-cas/latest').create();                                                                                                                                                             
rootCas                                                                                                                                                                                                            
   .addFile('/etc/pki/ca-trust/source/anchors/amrs-g2.cer');                                                                                                                                                        
require('https').globalAgent.options.ca = rootCas;    

试图遵循这种模式。 我仍然看到相同的问题。 有人有想法么? 我应该提到我正在运行节点版本4.5.0和npm版本2.15.9。

我尝试过弄乱版本,但是无法正常工作。

编辑1:

尝试将节点版本更新为10.0.0 Npm版本5.6.0

再次尝试安装npm,这次出现了一个奇怪的错误...

npm install
npm ERR! code E418
npm ERR! 418 I'm a teapot: async@^1.5.2

编辑2:

试图反复运行命令,似乎失败的库或多或少是随机的。

npm ERR! code E418
npm ERR! 418 I'm a teapot: grpc@^1.0.0
^C
[nbkiq0w@localhost node]$ npm install 
npm ERR! code E418
npm ERR! 418 I'm a teapot: google-protobuf@^3.0.0
^C
[nbkiq0w@localhost node]$ npm install 
npm ERR! code E418
npm ERR! 418 I'm a teapot: lodash@^4.6.1
^C
[nbkiq0w@localhost node]$ npm install 
npm ERR! code E418
npm ERR! 418 I'm a teapot: grpc@^1.0.0
^C
[nbkiq0w@localhost node]$ npm install 
npm ERR! code E418
npm ERR! 418 I'm a teapot: lodash@^4.6.1

好像它只是失败的,无论图书馆,我试图更新我的代理设置,如看到这里 似乎没有帮助。

编辑3:

切换回节点6.12.0,并看到原始tls错误。 我的一位朋友能够按原样下载节点目录,并在他的计算机上运行(使用6.12.0),因此它必须与我的计算机隔离。

我在另一页上找到了一些建议来调整在主目录中找到的.npmrc文件的建议。 我添加了以下行

cafile=<my cert file>

和npm安装工作。 我不确定我的朋友的安装为何有效,因为他什至没有此文件,但是暂时就足够了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM