我正在尝试在 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/