fenomas / noa

Experimental voxel game engine.
MIT License
611 stars 87 forks source link

Getting Tons of errors on start #142

Closed sourcerose closed 3 years ago

sourcerose commented 3 years ago

image I tried everything. There seems to be nothing on stack overflow about it.

Patbox commented 3 years ago

You need to install @babylonjs/core

sourcerose commented 3 years ago

image

Its in the package.json. When I do npm install it should install automatically

fenomas commented 3 years ago

Hm, are you creating a fresh project, or cloning an existing one, or where are you starting from?

Also is your project TS? If so then I probably won't know anything useful, but someone else may...

Patbox commented 3 years ago

Ok, I have another idea. Maybe add noa to main package.json (file:./noa-develop) and try using npm i with your main project

sourcerose commented 3 years ago

@Patbox I did those steps. Im still getting errors: image @andyhall Im using the Noa-Example hello world project. Then I modified the package.json to not pull noa-develop from github, but instead on my local computer Heres a full copy of my package.json:

{

  "name": "MinecraftJS",
  "version": "1.0.0",
  "description": "Minecraft coded in Javascript that runs in the Web.",
  "scripts": {
    "start": "cd src && webpack serve",
    "build": "rm -f docs/*.js*; cd src && webpack --env prod"
  },
  "dependencies": {
    "@babylonjs/core": "^4.2.0",
    "@babylonjs/inspector": "^4.2.0",
    "babylonjs": "^4.2.0",
    "noa-engine": "file:./noa-develop",
    "voxel-crunch": "^0.2.1"
  },
  "devDependencies": {
    "webpack": "^4.44.2",
    "webpack-cli": "^4.2.0",
    "webpack-dev-server": "^3.11.0"
  }
}
sourcerose commented 3 years ago

No matter what I seem to do, Even if I copy the exact code from noa-examples I'm getting this error: image

fenomas commented 3 years ago

Hi, if you cloned noa-engine locally, did you run npm install in that folder as well as in your game client's folder?

sourcerose commented 3 years ago

Yes, but even when I just use everything as you did in the noa-examples repo I'm still getting errors.

See here: https://repl.it/@MinecraftJS/noa-examples

fenomas commented 3 years ago

Hmm, something weird is going on. I think there are two separate issues. In your first screenshot, where there were tons of errors, I think that was because npm i had not been run in the local copy of the noa engine folder.

But for the second error, where micro-game-shell is not being found, this is weird. Long story short, I think there's an npm bug, and I think it will be fixed if you try running npm i in your project directory again.

The details are: I recently changed a dependency - I removed the dependency game-shell, and replaced it with a new dependency micro-game-shell. This change is not yet pushed to the main branch of noa, so currently noa's package.json in the master branch references the old dependency, and the #develop branch references the new one.

When I tried to replicate your issue locally, I cloned noa-examples and ran npm i. The first time I did that, for some reason npm installed game-shell instead of micro-game-shell. However, when I re-ran npm i a second time, npm swapped them and installed only the correct dependency. Also, when I nuke node_modules and run npm i things work correctly.

My theory is that perhaps on the first install, npm parsed the contents of the github repo before switching to the correct branch. And maybe subsequent installs work because the repo is now locally cached. Or maybe it's a race condition, I have no idea. But for me everything worked correctly the second time. Also on your repl.it link, I found that if I ran npm i in the console window, that fixed the error about not finding micro-game-shell.


Again, very weird issue and I'm not sure what's going on. But the way to check is, if you're using the #develop branch of noa and everything is installed correctly, then your node_modules folder should contain micro-game-shell and not game-shell. If it's the other way around, then try redoing npm i or clearing out node_modules or something similar, is my best guess.

sourcerose commented 3 years ago

Really weird. But that fixed it. 😅

Thanks!

fenomas commented 3 years ago

Weird, thanks for testing. I will try to push #develop changes to live soon, so this doesn't affect others...