我想将我的应用程序部署到heroku,它包含使用nightmare.js的web抓取,但我的应用程序在部署时无法工作。有什么问题吗?这是基本的代码。
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上呢?
发布于 2020-08-11 01:32:34
请提供更多信息:
你在package.json?
https://stackoverflow.com/questions/63344929
复制相似问题