prismarine-viewer
prismarine-viewer copied to clipboard
Getting error when trying to start mineflayerViewer
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
I've also got the same problem, it seems that there was a breaking change in node_canvas_webgl
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
And I'm also using python via the javascript bridge
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
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.