3

the nodejs script works when I do node main.js but when I compile it into an executable with pkg it gives me this error :

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

Error: Cannot find module './node' Require stack:

  • C:\snapshot\project\node_modules\hookcord\node_modules\snekfetch\src\index.js
  • C:\snapshot\project\node_modules\hookcord\src\fire.js
  • C:\snapshot\project\node_modules\hookcord\src\index.js
  • C:\snapshot\project\node_modules\hookcord\index.js
  • C:\snapshot\project\main.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 Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function._resolveFilename (pkg/prelude/bootstrap.js:1955:46) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at Module.require (pkg/prelude/bootstrap.js:1855:31) at require (node:internal/modules/cjs/helpers:102:18) at Object. (C:\snapshot\project\node_modules\hookcord\node_modules\snekfetch\src\index.js:3:19) at Module._compile (pkg/prelude/bootstrap.js:1930:22) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\snapshot\project\node_modules\hookcord\node_modules\snekfetch\src\index.js', 'C:\snapshot\project\node_modules\hookcord\src\fire.js', 'C:\snapshot\project\node_modules\hookcord\src\index.js', 'C:\snapshot\project\node_modules\hookcord\index.js', 'C:\snapshot\project\main.js' ], pkg: true }

1 Answer 1

0

Add not found module to package.json like this

"pkg": {
    "assets": [
      "./node"
    ]
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.