Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF output does not work because puppeteer fails to launch on Windows #231

Closed
fmatzy opened this issue Jun 10, 2020 · 8 comments
Closed

Comments

@fmatzy
Copy link

fmatzy commented Jun 10, 2020

My corporate policy prevents chrome to launch without specific extensions. Puppeteer troubleshooting guide provides how to solve this problem:

const browser = await puppeteer.launch({
  ignoreDefaultArgs: ['--disable-extensions'],
});

Please support to pass this launch option to puppeteer in pdf output procedure.

@yhatt
Copy link
Member

yhatt commented Jun 13, 2020

It's a clear reason but I wonder if ignoring --disable-extensions will really help you, because Marp makes a new empty profile with no bundled extensions instead using existed profile.

@yhatt
Copy link
Member

yhatt commented Jun 13, 2020

The updated v0.18.1 has supported CHROME_ENABLE_EXTENSIONS environment value to enable Chrome extensions while converting Markdown.

@fmatzy Try running SET CHROME_ENABLE_EXTENSIONS=1 right before using the latest Marp CLI. We would be greatful if you could report whether PDF conversion has worked.

@yhatt yhatt added the help wanted Extra attention is needed label Jun 21, 2020
@yhatt
Copy link
Member

yhatt commented Jul 5, 2020

We need feedbacks about CHROME_ENABLE_EXTENSIONS=1 env by users using restricted Chrome managed by organization.

@fmatzy What happened after that?

@fmatzy
Copy link
Author

fmatzy commented Jul 5, 2020

@yhatt
Thank you for adding CHROME_ENABLE_EXTENSIONS=1 env. Thanks to this env var, the error message Faled to launch the browser process is gone, but a new error Protocol error (IO.Read) is now raised. And I found that when using Puppeteer itself andpage.pdf() directly, I got the same error message Protocol error (IO.Read) too.

I suspect this is a problem with Puppeteer itself and my company's environment. But unfortunately I've moved to another project and am using a PC that is not covered by company policy and on which Puppeteer emits PDF files correctly, so I can't investigate the issue any further.

@yhatt yhatt removed the help wanted Extra attention is needed label Jul 5, 2020
@yhatt
Copy link
Member

yhatt commented Jul 5, 2020

Thanks. Probably the managed Chrome by the organization might have been stuck to an incompatible version (Chrome < 77) with the latest Puppeteer. See also: puppeteer/puppeteer#4609

At least it's proved that CHROME_ENABLE_EXTENSIONS is useful escape hatch to execute a restricted Chrome, so we are going to keep the environment flag.

@yhatt yhatt closed this as completed Jul 5, 2020
@sohwemong
Copy link

Same issue happened with the marp-vscode version.
Is there any valid parameter or advice?

Maybe this should be posted on marp-vscode, but since it is the same topic, I thought it would be better to post it here.
I apologize if this is not appropriate.

@yhatt
Copy link
Member

yhatt commented Jan 25, 2022

Marp for VS Code is using Marp CLI internally. You can try the above workaround by opening VS Code with Marp CLI specific environment value.

# Linux / macOS
CHROME_ENABLE_EXTENSIONS=1 code
# Windows
SET CHROME_ENABLE_EXTENSIONS=1
code

To open VS Code from CLI, you may have to run Shell command: Install 'code' command in PATH in the command palette of VS Code at first.

@sohwemong
Copy link

Thank you!
I was only thinking of editing settings.json.
I'm embarrassed...

Incidentally, if want to run VSCode by double-clicking on Windows, adding an environment variable in the GUI will work for sure.
I'd like to add this in case anyone else has the same question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants