Unexpected token with mineflyer on python via a bridge in a docker continer

429 Views Asked by At

I am creating a ubuntu:20.04 docker container and installing python 3.9 and node 16.x along with npm. I am then running a js library with a javascript to python bridge. The library is mineflyer and I am using it to create a discord.py bot. Running the files outside of a docker continer works perfectly fine(windows 10) but when I run the file inside one, it give me a error. ERROR:

Traceback (most recent call last):
  File "/code/bot.py", line 7, in <module>
    from mcbot import cheekline
  File "/code/mcbot.py", line 2, in <module>
[JSE] /usr/local/lib/python3.9/dist-packages/javascript/js/bridge.js:14
[JSE] const debug = process.env.DEBUG?.includes('jspybridge') ? console.debug : () => { }
[JSE]                                 ^
[JSE] SyntaxError: Unexpected token .
[JSE]     at Module._compile (internal/modules/cjs/loader.js:723:23)
[JSE]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
[JSE]     at Module.load (internal/modules/cjs/loader.js:653:32)
[JSE]     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
[JSE]     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
[JSE]     at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
[JSE]     at startup (internal/bootstrap/node.js:283:19)
[JSE]     at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

** The Node process has crashed. Please restart the runtime to use JS APIs. **

Timed out get 0 needsNodePatches None
    from javascript import require, On, Once, AsyncTask, once, off
  File "/usr/local/lib/python3.9/dist-packages/javascript/__init__.py", line 20, in <module>
    init()
  File "/usr/local/lib/python3.9/dist-packages/javascript/__init__.py", line 16, in init
    if config.global_jsi.needsNodePatches():
  File "/usr/local/lib/python3.9/dist-packages/javascript/proxy.py", line 225, in __getattr__
    methodType, val = self._exe.getProp(self._pffid, attr)
  File "/usr/local/lib/python3.9/dist-packages/javascript/proxy.py", line 145, in getProp
    resp = self.ipc("get", ffid, method)
  File "/usr/local/lib/python3.9/dist-packages/javascript/proxy.py", line 38, in ipc
    raise Exception(f"Timed out accessing '{attr}'")
Exception: Timed out accessing 'needsNodePatches'
0

There are 0 best solutions below