Description
What version of pkg are you using?
6.2.0
What version of Node.js are you using?
locally latest, but specified node20-win-x64 when running pkg cmd
What operating system are you using?
Windows
What CPU architecture are you using?
x86_64
What Node versions, OSs and CPU architectures are you building for?
node20
Describe the Bug
When trying to build an application which has puppeteer 24.0.0 , it always throws the warning:
Warning Cannot include directory %1 into executable.
The directory must be distributed with executable as %2.
%1: node_modules\puppeteer.local-chromium
%2: path-to-executable/puppeteer
Warning Babel parse has failed: Unexpected token, expected "from" (1:12)
Warning Failed to make bytecode node20-x64 for file C:\snapshot\my_app\node_modules\typed-query-selector\shim.d.ts
I already tried copying the the .cache directory from %HOME%/.cache , where is the chrome.exe to the root of my project. Also by following the steps from: https://pptr.dev/guides/configuration#changing-the-default-cache-directory didn't do the trick.
Nevertheless the puppeteer package also uses ES6 inside typed-query-selector, which causes the warnings after the first one.
Expected Behavior
Should locate the executable from the .cache folder in your root project directory when specified in the .puppeterrc.js:
const {join} = require('path');
/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {
// Changes the cache location for Puppeteer.
cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};
To Reproduce
- Install latest Puppeteer version
- Run pkg app.js -t node20-win-x64
- Warnings occur, even though the application is running properly