imharvol / mineflayer-web-inventory

Web based viewer for your mineflayer bot's inventory
MIT License
79 stars 19 forks source link

Cannot find package 'mineflayer-web-inventory' imported from (On python) #35

Open EvilGeorgee opened 1 year ago

EvilGeorgee commented 1 year ago

web-inventory doesnt works on python image

Requires in my code: mineflayer = require('mineflayer') pathfinder = require('mineflayer-pathfinder') movements = require('mineflayer-pathfinder').Movements GoalNear = require('mineflayer-pathfinder').goals inventoryViewer = require('mineflayer-web-inventory') pvp = require('mineflayer-pvp').plugin

FanaticExplorer commented 1 year ago

I downloaded it using npm, it started, wrote then it started in browser. However, after opening page of inventory, page is basically blank, but the site has his title! So, it is still a problem.

imharvol commented 1 year ago

@FanaticExplorer Are you using python or just Javascript?

minecraft and mineflayer-web-inventory version?

FanaticExplorer commented 1 year ago

@FanaticExplorer Are you using python or just Javascript? I'm using Python and python module "javascript" to access everyting mineflayer-related.

minecraft and mineflayer-web-inventory version?

Minecraft version is 1.19.2 and mineflayer-web-inventory version is the latest, 1.8.4. The version is specified in the options of bot.

Also, I tried to activate it using javascript.eval_js():

output = eval_js('''const inventoryViewer = require('mineflayer-web-inventory')
inventoryViewer(bot)''')

But, I'm getting error:

☕  JavaScript Error  Call to 'evaluateWithContext' failed:
> output = eval_js('''const inventoryViewer = require('mineflayer-web-inventory')
  at <module> (d:\Python\MinecraftBot\pathfinder.py:24)
> 

... across the bridge ...

  at Readable.push (node:internal/streams/readable:234:10)
  at readableAddChunk (node:internal/streams/readable:297:9)
  at addChunk (node:internal/streams/readable:324:12)
  at Socket.emit (node:events:513:28)
  at Socket.<anonymous> (D:\Python\MinecraftBot\.venv\Lib\site-packages\javascript\js\bridge.js:278:18)
  at Bridge.onMessage (D:\Python\MinecraftBot\.venv\Lib\site-packages\javascript\js\bridge.js:226:25)
  at Bridge.call (D:\Python\MinecraftBot\.venv\Lib\site-packages\javascript\js\bridge.js:136:42)
  at Object.evaluateWithContext (D:\Python\MinecraftBot\.venv\Lib\site-packages\javascript\js\bridge.js:70:24)
  at eval (eval at evaluateWithContext (D:\Python\MinecraftBot\.venv\Lib\site-packages\javascript\js\bridge.js:70:24), <anonymous>:2:24)
  at eval (eval at evaluateWithContext (D:\Python\MinecraftBot\.venv\Lib\site-packages\javascript\js\bridge.js:70:24), <anonymous>:2:1) 
  TypeError: inventoryViewer is not a function
> ^
🌉 TypeError: inventoryViewer is not a function
FanaticExplorer commented 1 year ago

@imharvol, updating info about python compatibility.

I succeed to install mineflayer-web-inventory using npm. Now, bot starts normally even without javascript.eval_js(). However, if I try to open inventory viewer, I can't see any item in bot inventory. Instead, I see this. изображение The inventory does not update if I give bot more items. The buttons “Show/Hide JSON” don't seem to work, too.