Skip to content

JavaScript Error Call to 'require' failed:Β #143

Closed
@HaiYTB

Description

I can't require the mineflayer library. I use termux-monet latest version and python 3.11

β˜•  JavaScript Error  Call to 'require' failed:
> mineflayer = require("mineflayer")
  at <module> (/data/data/com.termux/files/home/minecraft-tool.py:13)
>

... across the bridge ...

  at defaultImportModuleDynamicallyForScript (node:internal/modules/esm/utils:227:31)
  at ModuleLoader.import (node:internal/modules/esm/loader:483:21)
  at TracingChannel.tracePromise (node:diagnostics_channel:337:14)
  at onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:484:36)
  at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
  at ModuleLoader.resolve (node:internal/modules/esm/loader:526:25)
  at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
  at defaultResolve (node:internal/modules/esm/resolve:1132:11)
  at moduleResolve (node:internal/modules/esm/resolve:915:18)
  at packageResolve (node:internal/modules/esm/resolve:842:9)
  Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'mineflayer' imported from /data/data/com.termux/files/usr/lib/python3.11/site-packages/javascript/js/deps.js
> ^
πŸŒ‰ Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'mineflayer' imported from /data/data/com.termux/files/usr/lib/python3.11/site-packages/javascript/js/deps.js
import os
try:
    from javascript import require
except:
    os.system("pip install javascript")
    from javascript import require
try:
    os.system("node -v")
except:
    os.system("apt install node -y")
#try:
install("mineflayer")
mineflayer = require("mineflayer")
"""except:
    os.system("cd")
    os.system("npm install mineflayer")
    mineflayer = require("mineflayer")"""
os.system("clear")
class Bot:
    def __init__ (self, host_server_mc, port_server_mc):
        self.host_server_mc = host_server_mc
        self.port_server_mc = port_server_mc
    def joinbot(self):
        settings_bot_server_mc = {
            "host": self.host_server_mc,
            "port": self.port_server_mc,
            "username": "HaiYTB"
        }
        bot_server_mc = mineflayer.createBot(settings_bot_server_mc)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions