Building .exe file with pkg results in "Failed to make bytecode"

Hey, I'm trying to build my node discord.js project into .exe file for ease of use. I managed to do so with https://www.npmjs.com/package/pkg by simply running it with pkg . --targets node18-win-x64 and below configuration:
"pkg": {
"scripts": "commands/**/*.js"
}
"pkg": {
"scripts": "commands/**/*.js"
}
I got following warnings though:
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\bounty-rune-bot\node_modules\file-type\index.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\bounty-rune-bot\node_modules\file-type\core.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\bounty-rune-bot\node_modules\file-type\supported.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\bounty-rune-bot\node_modules\file-type\util.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\bounty-rune-bot\node_modules\file-type\index.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\bounty-rune-bot\node_modules\file-type\core.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\bounty-rune-bot\node_modules\file-type\supported.js
> Warning Failed to make bytecode node18-x64 for file C:\snapshot\bounty-rune-bot\node_modules\file-type\util.js
and I have noticed that the .exe won't work without all node_modules copied into it's directory. I suspect it might be related to file-type not being bundled correctly, but maybe I'm missing something else. Thanks for help in advance.
npm
pkg
Package your Node.js project into an executable. Latest version: 5.8.1, last published: 5 months ago. Start using pkg in your project by running npm i pkg. There are 224 other projects in the npm registry using pkg.
4 Replies
d.js toolkit
d.js toolkit16mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
darp
darp16mo ago
just dont do it.
chewie
chewie16mo ago
not djs related, #useful-servers or #other-js-ts
Roirraw
RoirrawOP16mo ago
thank you @thehairy
Want results from more Discord servers?
Add your server