nmrugg/stockfish.js

Error when compiling with build.js

Jochengehtab opened this issue · 5 comments

Hello there,
if i run the build.js (first emsdk_env.bat and then node build.js) i always get this error:

<ref *1> Error: spawnSync emcc ENOENT
    at Object.spawnSync (node:internal/child_process:1110:20)
    at spawnSync (node:child_process:871:24)
    at execFileSync (node:child_process:914:15)
    at execFileSync (C:\Users\Thoma_wqsrfey\OneDrive\Desktop\Repo\build.js:222:12)
    at checkEmscriptenVersion (C:\Users\Thoma_wqsrfey\OneDrive\Desktop\Repo\build.js:244:23)
    at Object.<anonymous> (C:\Users\Thoma_wqsrfey\OneDrive\Desktop\Repo\build.js:344:5)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawnSync emcc',
  path: 'emcc',
  spawnargs: [ '--version' ],
  error: [Circular *1],
  status: null,
  signal: null,
  output: null,
  pid: 0,
  stdout: null,
  stderr: null
}
Warning:
C:\Users\Thoma_wqsrfey\OneDrive\Desktop\Repo\build.js:254
        console.error("\nCould not confirm emscripten version. Set your " + note("emcc") + " path with the " + note("--emcc") + " flag, or add " + not("--skip-em-check") + " to bypass this check.\n");

                        ^

ReferenceError: not is not defined
    at checkEmscriptenVersion (C:\Users\Thoma_wqsrfey\OneDrive\Desktop\Repo\build.js:254:127)
    at Object.<anonymous> (C:\Users\Thoma_wqsrfey\OneDrive\Desktop\Repo\build.js:344:5)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.17.0

Has anyone an idea what i am doing wrong?

Ya I just had this issue. The error is saying it can't find your emcc/em++. Run

emsdk activate 2.0.26

and it will give you instructions on how to add emcc to your path using source assuming emsdk is on your path or go to the folder you installed it in and add ./ before the command above.

@Jochengehtab Hey did you manage to fix this issue? I was having the same problem

Hi @phillipl21, i think i don't solve the Problem and found a soliton for my case.

Thanks @Jochengehtab , what was your solution? For now I manually copied stockfish.js from the repo into my project, but I don't know if this is best practice

Me either but i Got Stockfish to Work as a shared libary but not on the web.