Skip to content

JavaScript Error Call to 'require' failed #8

@Jac0bXu

Description

@Jac0bXu

Hi, I am trying to reproduce your research on a ubuntu system. I am running the example.py file but I keep getting these require canvas issues. Do you have any idea on how to solve this? I have installed the dependencies through setup_js.py as well as directly installing canvas using npm, but it did not work. Thank you.

python env/minecraft_server.py -H "0.0.0.0" -P 25565 -LP 5002 -U "Agent3" -W "world" -D False
Agent Agent3 login world at 0.0.0.0:25565
☕  JavaScript Error  Call to 'require' failed:
> mineflayerViewer = require('prismarine-viewer').mineflayer
  at <module> (/home/jacob-xu/Code/VillagerAgent-Minecraft-multiagent-framework/env/minecraft_server.py:40)
> 

... across the bridge ...

  at Module._compile (node:internal/modules/cjs/loader:1738:14)
  at Object.<anonymous> (/home/jacob-xu/anaconda3/envs/va/lib/python3.9/site-packages/javascript/js/node_modules/prismarine-viewer/viewer/lib/entities.js:7:26)
> const { createCanvas } = require('canvas')
🌉 Error: Cannot find module 'canvas'

Metadata

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