【发布时间】:2020-01-26 17:25:06
【问题描述】:
我的 bash 模拟器可以正确运行 curl 命令。但是当我在 nodejs 中使用 child_process 模块调用它时,我收到一个错误,指的是 libcurl 中不支持或禁用协议“'https”。
当我运行“curl 'https://ehire.51job.com/Candidate/SearchResumeNew.aspx'”时,我可以获得页面内容。
下面是nodejs代码:
var child_process = require("child_process");
var curl = "curl 'https://ehire.51job.com/Candidate/SearchResumeNew.aspx'";
var child = child_process.exec(curl, (err, stdout, stderr) =>
{
console.log(stdout);
console.log(err);
console.log(stderr);
});
【问题讨论】:
-
我试过这个完全相同的代码,似乎没有错误。除了变量
stdout,stderr没有值并且err是null。