'How to add missing package to exe file in Javascript with pkg
I am developing a program to send messages by whatsapp through whatsapp-web.js module, I want to make my program an executable, for this I am using "pkg", however when I generate the executable, I get the following message.
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
I already copied the path where it is requested, here you can see it in vscode
However, when I run the executable I get this:
C:\snapshot\romer\node_modules\puppeteer\lib\cjs\puppeteer\node\Launcher.js:105
throw new Error(missingText);
^
Error: Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (982053).
at ChromeLauncher.launch (C:\snapshot\romer\node_modules\puppeteer\lib\cjs\puppeteer\node\Launcher.js:105:23)
at PuppeteerNode.launch (C:\snapshot\romer\node_modules\puppeteer\lib\cjs\puppeteer\node\Puppeteer.js:125:31)
at Client.initialize (C:\snapshot\romer\node_modules\whatsapp-web.js\src\Client.js:95:39)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at process.runNextTicks [as _tickCallback] (node:internal/process/task_queues:65:3)
at Function.runMain (pkg/prelude/bootstrap.js:1941:13)
at node:internal/main/run_main_module:17:47
Does anyone know how to solve this error? I have searched in forums but I have not seen anything that helps me, my code in Github: https://github.com/rromerov/Whatsapp-Web-Project/blob/main/codigo.js
Solution 1:[1]
before, you should split the lines b/c it will loop into the string and check if the characters are ffff, and it won't be True
i will be a single character, so you should do first
dictionary = dictionary.split("\n")
BUT if your ffff is a line, if is a word separated with spaces you can do:
dictionary = dictionary.split(" ")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | XxJames07- |

