kolbytn / mindcraft

MIT License
1.86k stars 231 forks source link

TypeError when running ´node main.js´ #256

Open KonokoGV opened 1 week ago

KonokoGV commented 1 week ago

Hello,

whenever I try to run the main.js command I recieve following error message:

PS C:\Users\Anwender\Desktop\mindcraft> node main.js [ './andy.json' ] Using chat settings: { model: 'claude-3-5-sonnet-20241022', api: 'anthropic' } Using embedding settings: { api: 'anthropic' } Unknown embedding: anthropic . Using word overlap. Logging in... C:\Users\Anwender\Desktop\mindcraft\node_modules\mineflayer\lib\loader.js:108 const version = require('minecraft-data')(bot._client.version).version ^

TypeError: Cannot read properties of null (reading 'version') at next (C:\Users\Anwender\Desktop\mindcraft\node_modules\mineflayer\lib\loader.js:108:67) at createBot (C:\Users\Anwender\Desktop\mindcraft\node_modules\mineflayer\lib\loader.js:105:33) at initBot (file:///C:/Users/Anwender/Desktop/mindcraft/src/utils/mcdata.js:57:15) at Agent.start (file:///C:/Users/Anwender/Desktop/mindcraft/src/agent/agent.js:27:20)

Node.js v20.18.0 Agent process exited with code 1 and signal null Agent process ./andy.json exited too quickly and will not be restarted. All agent processes have ended. Exiting.

Sadly I have no knowledge about coding, so finding a solution is out of my reach. Any ideas on how to fix this? Hopefully this is an easy fix. Huge thanks in advance!

Lawtro37 commented 1 week ago

did you run "npm run postinstall" before running "node main.js"

this just applies necessary patches to minefayer

KonokoGV commented 1 week ago

did you run "npm run postinstall" before running "node main.js"

this just applies necessary patches to minefayer

I did. The same Error message appears

KonokoGV commented 1 week ago

are you using the right minecraft version?

1.20.4 :)

Lawtro37 commented 1 week ago

did you run "npm run postinstall" before running "node main.js" this just applies necessary patches to minefayer

I did. The same Error message appears

did you get an error when applying the minefayer patches

if so make sure that minefayer version is "^4.20.4" in the package.json and package-lock.json then run "npm install" again before running "npm run postinstall" again

otherwise I cant help you

to me this just looks like the patches are not being applyed to minefayer for some reason or another

KonokoGV commented 1 week ago

did you run "npm run postinstall" before running "node main.js" this just applies necessary patches to minefayer

I did. The same Error message appears

did you get an error when applying the minefayer patches

if so make sure that minefayer version is "^4.20.4" in the package.json and package-lock.json then run "npm install" again before running "npm run postinstall" again

otherwise I cant help you

to me this just looks like the patches are not being applyed to minefayer for some reason or another

I do recieve a warning: Warning: patch-package detected a patch file version mismatch

Don't worry! This is probably fine. The patch was still applied successfully. Here's the deets:

Patch file created for

mineflayer@4.20.1

applied to

mineflayer@4.23.0.

The version of mineflayer in package.json and package-lock.json is "^4.23.0", so a newer one. Is that bad?

I also tried just re-configuring the bot in another file, but there seems to be a problem with the wrong model and api showing. I use Anthropic and claude-3-5-sonnet-20241022. But it shows gpt-4o-mini and openai. Do you have some ideas about that maybe?