![](/img/trans.png)
[英]Uploading Images using Multer (works locally, but not when deployed on Heroku)
[英]Web scraper works locally but not when deployed to Heroku server
所以我尝试使用 SecretAgent web 刮板,当我运行 node app.js 时它可以工作,但是当我将文件结构部署到 Heroku 时,它不起作用,我收到以下大量错误:
https://i.stack.imgur.com/YNygo.jpg
https://i.stack.imgur.com/KwVr4.jpg
https://i.stack.imgur.com/iSKKv.jpg
我与 SecretAgent 的通话如下所示:
const agent = require('secret-agent');
(async () => {
await agent.goto('https://example.org');
const title = await agent.document.title;
const intro = await agent.document.querySelector('p').textContent;
console.log("intro is " + intro);
await agent.close();
})();
我还尝试在 cd 进入服务器文件夹后输入以下 sudo 命令,但最终收到错误“UnhandledErrorOrRejection”,“clientError:'TypeError:coreTab.goto is not a function'”:
sudo $(npx puppet-install-deps)
这就是我目前所在的位置。 任何帮助将非常感激。 如果我能更好地澄清这个问题,请告诉我——感谢您的所有帮助!
我从未使用过 Secret Agent,当然也没有将 web 刮板部署到 Heroku,但看起来在Docs Secret Agent 中尝试自动存储您的 Z21D6F40CFB511982E4424E0E250A95 数据。 据我了解,Heroku 不提供本机存储。 相反,您可以将其连接到数据库。 我相信正在发生的事情是您的特工无法存储 session 信息并崩溃。 你有什么原因不能在本地运行刮板吗? 如果您必须在 Heroku 上执行此操作,则需要连接数据库(如 JawsDB)并使用 sessionDir 强制它将您的信息存储在那里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.