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:
C:\snapshot\W.I.P WORKING EXE V2\noblox.js\lib\index.js
C:\snapshot\W.I.P WORKING EXE V2\Default.js
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
at Module._resolveFilename (node:internal/modules/cjs/loader:946:15)
at Function._resolveFilename (pkg/prelude/bootstrap.js:1951:46)
at Module._load (node:internal/modules/cjs/loader:787:27)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at Module.require (pkg/prelude/bootstrap.js:1851:31)
at require (node:internal/modules/cjs/helpers:102:18)
at C:\snapshot\W.I.P WORKING EXE V2\noblox.js\lib\index.js:14:28
at Array.forEach ()
at search (C:\snapshot\W.I.P WORKING EXE V2\noblox.js\lib\index.js:8:23)
at Object. (C:\snapshot\W.I.P WORKING EXE V2\noblox.js\lib\index.js:32:1)
at Module._compile (pkg/prelude/bootstrap.js:1926:22)
at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:834:12)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at Module.require (pkg/prelude/bootstrap.js:1851:31)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\snapshot\W.I.P WORKING EXE V2\Default.js)
at Module._compile (pkg/prelude/bootstrap.js:1926:22)
at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:834:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\snapshot\W.I.P WORKING EXE V2\noblox.js\lib\index.js',
'C:\snapshot\W.I.P WORKING EXE V2\Default.js'
],
pkg: true
}
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)
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)