snobu / destreamer

Save Microsoft Stream videos for offline enjoyment.
MIT License
2.36k stars 442 forks source link

Mac M1 stopped working #393

Open avefalco opened 3 years ago

avefalco commented 3 years ago

I recently got an M1 Mac, it stopped recognising the chromium even tho i have chronium installed.

the error: Launching headless Chrome to perform the OpenID Connect dance...

[ERROR] Error: Failed to launch the browser process! spawn /usr/bin/chromium-browser ENOENT

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

at onClose (/Users/Steve/destreamer/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
at ChildProcess.<anonymous> (/Users/Steve/destreamer/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:185:85)
at ChildProcess.emit (node:events:394:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:480:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)

i have tried changing the path into chrome with following code and rebuild but still no luck executablePath: '/Applications/Brave Browser.app/Contents/MacOS/Brave Browser',

snobu commented 3 years ago

Plugging in Brave should work, make sure executablePath is exactly what navigating to chrome://version shows in your browser.

snobu commented 3 years ago

Also, i think you also need to replace puppeteer with puppeteer-core for M1 Macs. See this other issue which has the solution - https://github.com/snobu/destreamer/issues/355

You may or may not have to do that, so try the simple solution first, getting the right executable path from chrome://version.

avefalco commented 3 years ago

Ok so I followed the post solution...

npm uninstall puppeteer; npm i puppeteer-core npm i; npm run build

Then on these files src/destreamer.ts, src/PuppeteerHelper.ts, and src/TokenCache.ts,  I changed import puppeteer from 'puppeteer-core'

Then I build again using

npm i; npm run build

But now I have these errors: up to date, audited 435 packages in 513ms

46 packages are looking for funding   run npm fund for details

found 0 vulnerabilities

@.*** build echo Transpiling TypeScript to JavaScript... && node node_modules/typescript/bin/tsc && echo Destreamer was built successfully.

Transpiling TypeScript to JavaScript... src/PuppeteerHelper.ts:14:26 - error TS2339: Property 'executablePath' does not exist on type 'typeof import("/Users/Steve/destreamer/node_modules/puppeteer-core/lib/types")'.

14         return puppeteer.executablePath();                             ~~~~~~

src/PuppeteerHelper.ts:17:43 - error TS2339: Property 'executablePath' does not exist on type 'typeof import("/Users/Steve/destreamer/node_modules/puppeteer-core/lib/types")'.

17     const browserPath: string = puppeteer.executablePath()                                              ~~~~~~

Found 2 errors.

Any clue how to fix this? On 28 Jun 2021, 4:20 AM -0700, Adrian Calinescu @.***>, wrote:

My bad, i think you also need to replace puppeteer with puppeteer for M1 Macs. See this other issue which has the solution -

355

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

notsuhas commented 2 years ago

Hi, I'm also stuck here with the same error. Can I know what to change in those 2 lines? @snobu @lukaarma

hidehiro98 commented 2 years ago

It works perfectly on Mac M1.

My steps are below.

  1. Changed puppeteer to puppeteer-core (https://github.com/snobu/destreamer/issues/355#issuecomment-811245127)
  2. Update codes (https://github.com/snobu/destreamer/issues/355#issuecomment-813587363)
  3. Commented out codes L. 13 to L. 18 in src/PuppeteerHelper.ts and added const browserPath = ''; on L. 19
  4. npm run build
  5. Yay!
lukaarma commented 2 years ago

I'm sorry for the late reply but life got in the way. Do you still need help?

niXta1 commented 1 year ago

It would be nice with a pre fixed M1 version 🤷🏼‍♂️

snobu commented 1 year ago

Happy to be gifted an M1 to build and test on. Let it be an Ultra just to make sure we cover that as well :)

But seriously though, if someone with an M1 sends a pull request with a fix, I'll merge it in.

niXta1 commented 1 year ago

Happy to be gifted an M1 to build and test on. Let it be an Ultra just to make sure we cover that as well :)

But seriously though, if someone with an M1 sends a pull request with a fix, I'll merge it in.

I’m just gonna win the lottery and it will be on it’s way 😉 Would it need to be in the old script or modified to a new separate m1 script?

@hidehiro98 seems to know what he’s doing. Any chances for a pull request?

hakt0-r commented 1 year ago

if ppl come looking for a fix on M1 macs and/or latest macOS see this https://github.com/snobu/destreamer/issues/487#issuecomment-1605586156