繁体   English   中英

将 Nightmare.js 应用程序部署到 Heroku(Node.js + Telegraf)

[英]Deploying Nightmare.js App To Heroku (Node.js + Telegraf)

我想将我的应用程序部署到 heroku,其中包含使用 nightmare.js 的网络抓取,并且我的应用程序在部署时不起作用。 问题是什么? 这是基本代码...

bot.on('text', async (ctx) => {
  try{

    
    var input = ctx.message.text

    const def1 = await nightmare

      .goto('https://www.google.com/')
      
      .type('#term' ,input)
      .type('#term', '\u000d')
      
      .wait(200)

      .click('#rso > div:nth-child(1) > div > div.r > a > h3')

      .wait(200)

      .evaluate(() => document.querySelector('#content > div:nth-child(1) > div.meaning').textContent)
      
      // .end()
      // .then(console.log)

      .catch(err => {
        console.error(err)
      })


    console.log('def1 == ' + def1)
    
    await ctx.reply(def1)

  }

  catch(err){
    console.error(err)
  }


}) 

我省略了一些基本的 require 和 init 语句以使代码看起来更简单。 而且它没有前端。 都是后端。

当我在 heroku 上托管它时,它什么也不做。 它说“干净退出 - 等待更改”。

那么我该怎么做才能将我的应用程序部署到 heroku?

请提供更多信息:

  • 您是否在 package.json 中设置了“引擎”?
  • heroku 日志到底说了什么?

暂无
暂无

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

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