Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error when trying to start mineflayerViewer #352

Open
JeffLegendPower opened this issue Feb 12, 2023 · 5 comments
Open

Getting error when trying to start mineflayerViewer #352

JeffLegendPower opened this issue Feb 12, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@JeffLegendPower
Copy link

I'm using the example of streaming to python, but when I run the javascript code I get this error:

TypeError: createCanvas is not a function                                                                                     
    at module.exports (C:\Users\goyal_hfho3dz\WebstormProjects\mineflayz\node_modules\prismarine-viewer\lib\headless.js:18:18)
    at EventEmitter.<anonymous> (C:\Users\goyal_hfho3dz\WebstormProjects\mineflayz\mineflayz.js:11:20)                        
    at Object.onceWrapper (node:events:627:28)
    at EventEmitter.emit (node:events:525:35)
    at Client.<anonymous> (C:\Users\goyal_hfho3dz\WebstormProjects\mineflayz\node_modules\mineflayer\lib\plugins\health.js:13:11)
    at Object.onceWrapper (node:events:628:26)
    at Client.emit (node:events:525:35)
    at FullPacketParser.<anonymous> (C:\Users\goyal_hfho3dz\WebstormProjects\mineflayz\node_modules\minecraft-protocol\src\client.js:91:12)
    at FullPacketParser.emit (node:events:513:28)
    at addChunk (C:\Users\goyal_hfho3dz\WebstormProjects\mineflayz\node_modules\readable-stream\lib\_stream_readable.js:298:12)

This is my code:

const mineflayer = require('mineflayer')
const mineflayerViewer = require('prismarine-viewer').headless

bot = mineflayer.createBot({
    'host': 'localhost',
    'port': 25565,
    'username': 'bottee'
})

bot.once('spawn', () => {
    const client = mineflayerViewer(bot, { output: '127.0.0.1:8089', frames: -1, width: 512, height: 512 })
})

Manually installing canvas or node_canvas_webgl doesn't help

@TheTwoBoom
Copy link

I've also got the same problem, it seems that there was a breaking change in node_canvas_webgl

@TheTwoBoom
Copy link

I'm not finding any older releases of node_canvas_webgl on github, is there like a official github repo of node_canvas_webgl or is it this github repo? https://github.com/akira-cn/node-canvas-webgl

@TheTwoBoom
Copy link

And I'm also using python via the javascript bridge

@TheTwoBoom
Copy link

A Ryzen 9 5900X and Fedora 36 on the development system (errors on this system) and a Ryzen 5 1600 and Debian 11 on the final deployment system

@rom1504 rom1504 added the bug Something isn't working label Dec 17, 2023
@joshuademarco
Copy link

Install this dependency "npm install PrismarineJS/node-canvas-webgl" and make sure to have VisualStudio Desktop C++ Development Kit installed. That solved the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants