nodejs chrome无服务器ENOENT错误本地测试

时间:2019-06-10 11:17:37

标签: node.js puppeteer serverless-framework

使用以下instructions安装puppeteer之后,我尝试在本地调用无服务器功能。使用以下命令serverless invoke local -f myfunction会出现此错误:

Serverless: Injecting Headless Chrome...

  Error --------------------------------------------------

  ENOENT: no such file or directory, unlink '/home/user/Desktop/scrape/.build/handler.js'

我不确定为什么由于文件确实存在而收到此错误

它指向的处理程序文件如下:

const launch = require('@serverless-chrome/lambda')

const handler = require('./l5eo0hsbprn___handler.js')
const options = {"flags":[]}

module.exports.myfunction = function ensureHeadlessChrome (
  event,
  context,
  callback
) {
  return (typeof launch === 'function' ? launch : launch.default)(options)
    .then(instance =>
      handler.myfunction(event, context, callback, instance))
    .catch((error) => {
      console.error(
        'Error occured in serverless-plugin-chrome wrapper when trying to ' +
          'ensure Chrome for myfunction() handler.',
        options,
        error
      )

      callback(error)
    })
}

0 个答案:

没有答案