【问题标题】:node https get request to public api results in Error: CERT_UNTRUSTED节点 https 获取对公共 api 的请求导致错误:CERT_UNTRUSTED
【发布时间】:2014-08-21 05:45:18
【问题描述】:

尝试对公共 api 执行简单的 https 请求,但我收到“错误:CERT_UNTRUSTED”

require('https');

var options = {
  host: 'btc-e.com',
  path: '/api/2/btc_usd/ticker',
  port: '443',
  method: 'GET',
  headers: {accept:'*/*'}
};

var req = https.get(options, function(res) {
 console.log(res.statusCode);
 res.on('data', function(d) {
    process.stdout.write(d);
 });
});

req.on('error', function(e) {
  console.error(e);
});

【问题讨论】:

    标签: node.js api https get request


    【解决方案1】:

    解决了!我只需要使用以下命令更新我的节点安装:

    sudo npm 缓存清理 -f 须藤 npm 安装 -g n sudo n 稳定

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-01
      • 1970-01-01
      • 2018-06-04
      • 2018-01-03
      • 2018-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多