ulixee / hero

The web browser built for scraping
MIT License
800 stars 41 forks source link

M1 Not Launching Chrome #146

Closed kostrykin closed 2 years ago

kostrykin commented 2 years ago

I am trying to run the first example and getting the following error:

Started Ulixee server at localhost:60465
2022-08-30T03:39:46.429Z ERROR [hero-core/connections/ConnectionToHeroClient] ConnectionToClient.HandleRequestError { context: {}, sessionId: undefined, sessionName: undefined } BrowserLaunchError: Could not write to connection with Browser Process: write EPIPE
------BROWSER_CREATION_Q--------------------------
    at Queue.run (/path/node_modules/commons/lib/Queue.ts:40:19)
    at Pool.getBrowser (/path/node_modules/core/lib/Pool.ts:126:44)
    at Agent.open (/path/node_modules/core/lib/Agent.ts:108:34)
    at async Session.openBrowser (/path/node_modules/core/lib/Session.ts:385:5)
    at async Function.create (/path/node_modules/core/lib/Session.ts:867:9)
    at async ConnectionToHeroClient.createSession (/path/node_modules/core/connections/ConnectionToHeroClient.ts:190:30)
    at async CommandRunner.runFn (/path/node_modules/core/lib/CommandRunner.ts:36:14)
    at async ConnectionToHeroClient.executeCommand (/path/node_modules/core/connections/ConnectionToHeroClient.ts:252:12)
    at async ConnectionToHeroClient.handleRequest (/path/node_modules/core/connections/ConnectionToHeroClient.ts:65:14) {
  isSandboxError: false
}
Automatically shutting down Hero Core (Browser Closed)
2022-08-30T03:39:46.438Z ERROR [hero-core/index] UnhandledErrorOrRejection { context: {}, sessionId: null, sessionName: undefined } Error [BrowserLaunchError]: Could not write to connection with Browser Process: Ulixee Server failed to launch Chrome - write EPIPE. See server logs for details.
------BROWSER_CREATION_Q--------------------------
    at Queue.run (/path/node_modules/commons/lib/Queue.ts:40:19)
    at Pool.getBrowser (/path/node_modules/core/lib/Pool.ts:126:44)
    at Agent.open (/path/node_modules/core/lib/Agent.ts:108:34)
    at async Session.openBrowser (/path/node_modules/core/lib/Session.ts:385:5)
    at async Function.create (/path/node_modules/core/lib/Session.ts:867:9)
    at async ConnectionToHeroClient.createSession (/path/node_modules/core/connections/ConnectionToHeroClient.ts:190:30)
    at async CommandRunner.runFn (/path/node_modules/core/lib/CommandRunner.ts:36:14)
    at async ConnectionToHeroClient.executeCommand (/path/node_modules/core/connections/ConnectionToHeroClient.ts:252:12)
    at async ConnectionToHeroClient.handleRequest (/path/node_modules/core/connections/ConnectionToHeroClient.ts:65:14)
------REMOTE CORE---------------------------------
    at Function.reviver (/path/node_modules/commons/lib/TypeSerializer.ts:232:26)
    at JSON.parse (<anonymous>)
    at Function.parse (/path/node_modules/commons/lib/TypeSerializer.ts:31:17)
    at WsTransportToCore.onMessage (/path/node_modules/net/lib/WsTransportToCore.ts:111:36)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage (/path/node_modules/ws/lib/websocket.js:1068:20)
    at Receiver.emit (node:events:513:28)
    at Receiver.dataMessage (/path/node_modules/ws/lib/receiver.js:517:14)
    at /path/node_modules/ws/lib/receiver.js:468:23
    at /path/node_modules/ws/lib/permessage-deflate.js:308:9
------CONNECTION----------------------------------
    at new Resolvable (/path/node_modules/commons/lib/Resolvable.ts:16:18)
    at createPromise (/path/node_modules/commons/lib/utils.ts:168:10)
    at PendingMessages.create (/path/node_modules/net/lib/PendingMessages.ts:47:44)
    at ConnectionToHeroCore.sendRequest (/path/node_modules/net/lib/ConnectionToCore.ts:153:50)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async CoreCommandQueue.sendRequest (/path/node_modules/client/lib/CoreCommandQueue.ts:287:12)
    at async Object.cb (/path/node_modules/client/lib/CoreCommandQueue.ts:229:16)
    at async Queue.next (/path/node_modules/commons/lib/Queue.ts:95:19)
------CORE COMMANDS-------------------------------
    at Queue.run (/path/node_modules/commons/lib/Queue.ts:40:19)
    at CoreCommandQueue.run (/path/node_modules/client/lib/CoreCommandQueue.ts:218:8)
    at Object.cb (/path/node_modules/client/lib/CoreSessions.ts:31:64)
    at Queue.next (/path/node_modules/commons/lib/Queue.ts:95:44)
    at Queue.run (/path/node_modules/commons/lib/Queue.ts:43:10)
    at CoreSessions.create (/path/node_modules/client/lib/CoreSessions.ts:30:8)
    at ConnectionToHeroCore.createSession (/path/node_modules/client/connections/ConnectionToHeroCore.ts:62:38)
    at Hero._Hero_getCoreSessionOrReject (/path/node_modules/client/lib/Hero.ts:550:10)
    at Hero.get activeTab [as activeTab] (/path/node_modules/client/lib/Hero.ts:158:33)
    at Hero.goto (/path/node_modules/client/lib/Hero.ts:385:17)
------AGENT QUEUE---------------------------------
    at Queue.run (/path/node_modules/commons/lib/Queue.ts:40:19)
    at CoreSessions.create (/path/node_modules/client/lib/CoreSessions.ts:30:8)
    at ConnectionToHeroCore.createSession (/path/node_modules/client/connections/ConnectionToHeroCore.ts:62:38)
    at Hero._Hero_getCoreSessionOrReject (/path/node_modules/client/lib/Hero.ts:550:10)
    at Hero.get activeTab [as activeTab] (/path/node_modules/client/lib/Hero.ts:158:33)
    at Hero.goto (/path/node_modules/client/lib/Hero.ts:385:17)
    at /path/scrap.js:7:14
    at Object.<anonymous> (/path/scrap.js:11:3)
    at Module._compile (node:internal/modules/cjs/loader:1119:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1173:10) {
  isSandboxError: false
}

For Installation, I used the npm i --save @ulixee/hero-playground instruction. It is a fresh installation.

This is my first time using NodeJS so I don't quite know where to start looking for the problem.

blakebyrnes commented 2 years ago

Thanks for reporting. It sounds like Chrome didn't install properly. What operating system are you running?

kostrykin commented 2 years ago

Operating System is MacOS (M1). The installation routine told me that Chrome is being downloaded and installed (it indeed took a while).

blakebyrnes commented 2 years ago

Ah, ok. Yes, M1 has a known bug that is causing it not to launch. Will be fixed in the next release (hopefully this week).

blakebyrnes commented 2 years ago

This is the issue (this is the internal engine in Hero - built as part of the same project). https://github.com/unblocked-web/agent/issues/7

blakebyrnes commented 2 years ago

Fixed in 2.0.0-alpha.11