roos-robert/BeepPool-GUI-Miner

Problem with PKG Nimiq miner

Closed this issue · 2 comments

I have a problem with packaging my own node.js to a .exe with PKG to use with a windows gui,
pkg --targets node9-win index.js --pool=eu.alphapool.com:443

i get bootstrap error:

      throw error;
      ^

Error: Module did not self-register.
    at Object.Module._extensions..node (module.js:668:18)
    at Module.load (module.js:558:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Module.require (module.js:583:17)
    at Module.require (pkg/prelude/bootstrap.js:1153:31)
    at require (internal/module.js:11:18)
    at bindings (C:\snapshot\core\node_modules\bindings\bindings.js:81:44)
    at Object.<anonymous> (C:\snapshot\core\node_modules\node-lmdb\index.js:3:37)
    at Module._compile (pkg/prelude/bootstrap.js:1243:22)```

with building i get: 
```> pkg@4.3.1
> Warning Cannot resolve 'script'
  C:\Users\User\Desktop\Alpha\core\dist\node.js
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.
> Warning Cannot resolve 'script'
  C:\Users\User\Desktop\Alpha\core\dist\node.js
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.```

Thank you very much in advance

nvm fixed

I'm trying to pack my own miner too, I'm running PKG from the repository root folder like so:

$ pkg clients/nodejs/index.js -t node10-macos-x64
> pkg@4.3.4
> Warning Cannot resolve 'process.env.NIMIQ_WS_ENGINE || 'ws''
  /Users/user/Desktop/Nimizuela/miner/core/dist/node.js
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.
> Warning Cannot resolve 'script'
  /Users/user/Desktop/Nimizuela/miner/core/dist/node.js
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.
> Warning Cannot resolve 'script'
  /Users/user/Desktop/Nimizuela/miner/core/dist/node.js
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.
> Warning Cannot include addon %1 into executable.
  The addon must be distributed with executable as %2.
  /Users/user/Desktop/Nimizuela/miner/core/node_modules/cpuid-git/build/Release/cpuid.node

path-to-executable/cpuid.node

Also when I try to run the binary I get this:

$ ./index 
Uncaught exception: Cannot find module 'ws'
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.

Is there a guide or some tutorial on how to properly do the packing?