You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to generate a PDF using puppeteer. However, this didn't work as yarn threw an error. This seems to be related to the file urls, as this issue only occurs when I call puppeteer's pdf method to generate and save the file.
I've found similar issues with different use cases:
yarn && yarn build to install deps and build files
yarn start
Running yarn start should log the following error message:
TypeError: p.match is not a function
at Object.toPortablePath (D:\[...]\yarn2-puppeteer-pdf\.pnp.cjs:6092:35)
at PosixFS.mapToBase (D:\[...]\yarn2-puppeteer-pdf\.pnp.cjs:12033:24)
at PosixFS.fsMapToBase (D:\[...]\yarn2-puppeteer-pdf\.pnp.cjs:8097:25)
at PosixFS.writeFilePromise (D:\[...]\yarn2-puppeteer-pdf\.pnp.cjs:7937:18)
at URLFS.writeFilePromise (D:\[...]\yarn2-puppeteer-pdf\.pnp.cjs:7936:30)
at Object.getReadableAsBuffer (D:\[...]\yarn2-puppeteer-pdf\build\index.js:2258:29)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Page.pdf (D:\[...]\yarn2-puppeteer-pdf\build\index.js:7424:16)
at async printPdf (D:\[...]\yarn2-puppeteer-pdf\build\index.js:25371:3)
at async main (D:\[...]\yarn2-puppeteer-pdf\build\index.js:25381:5)
The parameter p passed to Object.toPortablePath has the following value:
Just ran into this too trying to generate a PDF with puppeteer. The stack trace for me is:
c:\[...]\YarnTest\.pnp.cjs:5162
if (windowsPathMatch = p.match(WINDOWS_PATH_REGEXP)) p = `/${windowsPathMatch[1]}`;else if (uncWindowsPathMatch = p.match(UNC_WINDOWS_PATH_REGEXP)) p = `/unc/
${uncWindowsPathMatch[1] ? `.dot/` : ``}${uncWindowsPathMatch[2]}`;
^
TypeError: p.match is not a function
at Object.toPortablePath (c:\[...]\YarnTest\.pnp.cjs:5162:28)
at PosixFS.mapToBase (c:\[...]\YarnTest\.pnp.cjs:9952:18)
at PosixFS.fsMapToBase (c:\[...]\YarnTest\.pnp.cjs:6659:19)
at PosixFS.writeFilePromise (c:\[...]\YarnTest\.pnp.cjs:6536:46)
at URLFS.writeFilePromise (c:\[...]\YarnTest\.pnp.cjs:6536:24)
at Object.getReadableAsBuffer (c:\[...]\YarnTest\.yarn\unplugged\puppeteer-npm-12.0.0-0f876e526f\node_modules\puppeteer\lib\cjs\puppeteer\common\helper.js:250:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Page.pdf (c:\[...]\YarnTest\.yarn\unplugged\puppeteer-npm-12.0.0-0f876e526f\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:2104:16)
at async c:\[...]\YarnTest\example-2.js:12:3
Using node v16.13.0 and yarn 3.1.1 on Windows 8.1.
I got similar error when starting up unpacked electron app with yarn berry, but I fixed it.
According to yarn's doc about pnp, you can try add "NODE_OPTIONS" to your scripts.
Self-service
Describe the bug
I've tried to generate a PDF using puppeteer. However, this didn't work as yarn threw an error. This seems to be related to the file urls, as this issue only occurs when I call puppeteer's
pdf
method to generate and save the file.I've found similar issues with different use cases:
I've tried both yarn v2 and yarn v3 (latest version) without any change to the outcome.
To reproduce
Repo: https://github.com/unzico/yarn2-puppeteer-pdf
git clone
this projectcd
into this projectyarn && yarn build
to install deps and build filesyarn start
Running
yarn start
should log the following error message:The parameter
p
passed toObject.toPortablePath
has the following value:See: https://developer.mozilla.org/en-US/docs/Web/API/File_Handle_API
Environment
The text was updated successfully, but these errors were encountered: