vercel / pkg

Package your Node.js project into an executable
https://npmjs.com/pkg
MIT License
24.28k stars 1.01k forks source link

pkg cannot find a folder that exists #1976

Closed SoraiaProjects closed 1 year ago

SoraiaProjects commented 1 year ago

What version of pkg are you using?

5.8.1

What version of Node.js are you using?

v18.17.1

What operating system are you using?

Windows 10 Version 22H2

What CPU architecture are you using?

AMD64

What Node versions, OSs and CPU architectures are you building for?

node18-win-x64

Describe the Bug

So I made an app that requires the package noblox.js and when I run it it works just fine but when I build it with pkg and I execute the EXE file it gives me the following error:

pkg/prelude/bootstrap.js:1872 throw error; ^

Error: Cannot find module 'C:\snapshot\W.I.P WORKING EXE V2\noblox.js\lib\cache' Require stack:

I have checked and the cache folder is in there, I've also tried editing index.js but since it works fine without pkg I figured that wouldn't be the reason. In Default.js I've required noblox.js by doing const nobloxjs = require("./noblox.js") as it wasn't working without the directory too (It was going directly to snapshot/node_modules/noblox.js).

Expected Behavior

It is supposed to go through and find cache and just work fine, it shows a text "SSTLR - ON" when it starts listening on port 6969 (I'm using Express for that) but that never happens.

To Reproduce

I'm not sure about how this is even happening but:

1 - Make a JavaScript (no ESM) file and require the package "noblox.js" 2 - Make it console.log something if you want just to make sure it reaches the end 2 - Build it with "pkg -t node18-win-x64 FILE_NAME.js" 3 - Run the executable and it shouldn't work (at least it doesn't for me)

SoraiaProjects commented 1 year ago

Fixed, my dumbass didn't read the config and therefore I did not add the assets in the package.json