javascript - 为什么 Puppeteer-firefox 在服务器上不起作用?

标签 javascript node.js puppeteer

我正在尝试在 Windows Server 2008 和 2016 上运行 有什么解决方案可以启动它吗?我搜索了很多,但一无所获。 我收到错误:

C:\Users\Administrator\Desktop\_t>node app.js
ERROR: The process "1212" not found.
(node:4276) UnhandledPromiseRejectionWarning: Error: Failed to launch Firefox!


    at onClose (C:\Users\Administrator\Desktop\_t\node_modules\puppeteer-firefox
\lib\Launcher.js:263:14)
    at Interface.helper.addEventListener (C:\Users\Administrator\Desktop\_t\node
_modules\puppeteer-firefox\lib\Launcher.js:252:50)
    at Interface.emit (events.js:187:15)
    at Interface.close (readline.js:379:8)
    at Socket.onend (readline.js:157:10)
    at Socket.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1094:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  -- ASYNC --
    at Puppeteer.<anonymous> (C:\Users\Administrator\Desktop\_t\node_modules\pup
peteer-firefox\lib\helper.js:31:27)
    at C:\Users\Administrator\Desktop\_t\a.js:253:21
    at afterLogin (C:\Users\Administrator\Desktop\_t\a.js:277:4)
    at Object.start (C:\Users\Administrator\Desktop\_t\a.js:101:2)
    at Object.<anonymous> (C:\Users\Administrator\Desktop\_t\app.js:156:7)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:282:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
(node:4276) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
error originated either by throwing inside of an async function without a catch
block, or by rejecting a promise which was not handled with .catch(). (rejection
 id: 1)
(node:4276) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
 Node.js process with a non-zero exit code.

在 Ubuntu 服务器上:

(node:7869) UnhandledPromiseRejectionWarning: Error: Failed to launch Firefox!


    at onClose (/root/node_modules/puppeteer-firefox/lib/Launcher.js:263:14)
    at Interface.helper.addEventListener (/root/node_modules/puppeteer-firefox/lib/Launcher.js:252:50)
    at Interface.emit (events.js:194:15)
    at Interface.close (readline.js:379:8)
    at Socket.onend (readline.js:157:10)
    at Socket.emit (events.js:194:15)
    at endReadableNT (_stream_readable.js:1103:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  -- ASYNC --
    at Puppeteer.<anonymous> (/root/node_modules/puppeteer-firefox/lib/helper.js:31:27)
    at /root/a.js:255:21
    at afterLogin (/root/a.js:269:4)
    at Object.start (/root/a.js:102:2)
    at Object.<anonymous> (/root/app.js:156:7)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
(node:7869) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7869) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

它至少可以在某些服务器上运行吗? 在我的台式计算机上一切正常。

需要适用于 Firefox 的版本 Puppeteer-firefox

最佳答案

我在我的 VPS Windows 上遇到了同样的问题(无法启动 Firefox)。

所以我去了node_modules/puppeteer-firefox/.local-browser/.../firefox.exe并尝试打开它。当我尝试打开 exe 文件时,出现 0xc00007b 错误

下载适用于 Windows 的“All in One Runtimes”并开始安装所有软件。我做了这个,这对我有用。 尝试一下然后告诉我!

编辑:(抱歉英语不好)

关于javascript - 为什么 Puppeteer-firefox 在服务器上不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59400236/

相关文章:

javascript - 如何点击显示 :none element with puppeteer?

html - 用于 puppeteer 操作的 C# API

javascript - http put 的 AngularJS(500 内部服务器错误)

javascript - ExtJS MVC 表单引用

javascript - Reactjs 在箭头函数中调用箭头函数

javascript - React + Webpack 不解析文件加载器

javascript - 如何选择具有自定义文件结尾的任意层深度的所有文件夹和子文件夹?

javascript - PHP 在 Jquery UI 自动完成中显示数组

Javascript - 很多独立函数都很糟糕??? ( Node .js)

javascript - PUPPETEER - 循环内的随机设置超时不起作用