code0wl/Multiplayer-Phaser-game

Error when running code from repo

RedHoodJT1988 opened this issue ยท 17 comments

I have been going through the book now for a few days and have reached Chapter 6. I have tried two ways, the first way was coding along with the book and then refactoring out my code along with the books when you gave the full file of how it should look without the comments. The second way I tried was just reading the book and then moving to each branch that corresponds to the chapter I was on. After the initial "Hey this is working page" my code wouldn't compile right nor would it run. The error that I get is below:
`Phaser-game (chapter/7)
$ npm start

Multiplayer-game@1.0.0 prestart C:\Users\jonat\Desktop\Phaser3 Projects\multiplayer\Multiplayer-Phaser-game
npm i && tsc -p ./

fsevents@1.1.1 install C:\Users\jonat\Desktop\Phaser3 Projects\multiplayer\Multiplayer-Phaser-game\node_modules\fsevents
node install

added 120 packages and removed 39 packages in 20.004s
../../../../node_modules/@types/prop-types/index.d.ts(32,38): error TS1005: '=' expected.
../../../../node_modules/@types/prop-types/index.d.ts(34,46): error TS1005: ';' expected.
../../../../node_modules/@types/prop-types/index.d.ts(34,75): error TS1005: ';' expected.
../../../../node_modules/@types/prop-types/index.d.ts(34,99): error TS1005: ';' expected.
../../../../node_modules/@types/prop-types/index.d.ts(36,47): error TS1005: ';' expected.
../../../../node_modules/@types/prop-types/index.d.ts(36,48): error TS1109: Expression expected.
../../../../node_modules/@types/prop-types/index.d.ts(36,49): error TS1109: Expression expected.
../../../../node_modules/@types/prop-types/index.d.ts(36,76): error TS1109: Expression expected.
../../../../node_modules/@types/prop-types/index.d.ts(36,100): error TS1005: ';'
expected.
../../../../node_modules/@types/prop-types/index.d.ts(36,103): error TS1109: Expression expected.
../../../../node_modules/@types/prop-types/index.d.ts(36,119): error TS1109: Expression expected.
../../../../node_modules/@types/prop-types/index.d.ts(36,144): error TS1005: ';'
expected.
../../../../node_modules/@types/prop-types/index.d.ts(36,152): error TS1128: Declaration or statement expected.
../../../../node_modules/@types/prop-types/index.d.ts(36,160): error TS1005: ','
expected.
../../../../node_modules/@types/prop-types/index.d.ts(38,50): error TS1005: ';' expected.
../../../../node_modules/@types/prop-types/index.d.ts(38,51): error TS1109: Expression expected.
../../../../node_modules/@types/prop-types/index.d.ts(38,52): error TS1109: Expression expected.
../../../../node_modules/@types/prop-types/index.d.ts(38,69): error TS1005: '(' expected.
../../../../node_modules/@types/prop-types/index.d.ts(38,71): error TS1128: Declaration or statement expected.
../../../../node_modules/@types/prop-types/index.d.ts(51,30): error TS1005: ';' expected.
../../../../node_modules/@types/prop-types/index.d.ts(51,54): error TS1005: ';' expected.
../../../../node_modules/@types/prop-types/index.d.ts(51,57): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(65,51): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(66,17): error TS1005: ',' expected.
../../../../node_modules/@types/react/index.d.ts(67,25): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(116,21): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(116,29): error TS1131: Property
or signature expected.
../../../../node_modules/@types/react/index.d.ts(116,35): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(116,41): error TS1005: ':' expected.
../../../../node_modules/@types/react/index.d.ts(116,55): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(116,63): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(116,67): error TS1128: Declaration or statement expected.
../../../../node_modules/@types/react/index.d.ts(117,5): error TS1128: Declaration or statement expected.
../../../../node_modules/@types/react/index.d.ts(325,50): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(325,72): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(325,75): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(744,15): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(744,29): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(746,13): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(746,16): error TS1005: ')' expected.
../../../../node_modules/@types/react/index.d.ts(750,15): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(750,29): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(751,17): error TS1005: ':' expected.
../../../../node_modules/@types/react/index.d.ts(751,31): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(751,39): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(752,17): error TS1128: Declaration or statement expected.
../../../../node_modules/@types/react/index.d.ts(752,26): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(753,42): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(753,71): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(754,21): error TS1005: ',' expected.
../../../../node_modules/@types/react/index.d.ts(755,17): error TS1005: ',' expected.
../../../../node_modules/@types/react/index.d.ts(756,13): error TS1005: ',' expected.
../../../../node_modules/@types/react/index.d.ts(756,16): error TS1005: ')' expected.
../../../../node_modules/@types/react/index.d.ts(765,11): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(765,47): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(766,13): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(767,17): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(767,31): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(771,11): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(771,40): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(772,13): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(772,34): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(773,13): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(773,46): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(815,56): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(815,78): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(815,86): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(816,57): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(816,84): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(816,87): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(2686,31): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2688,13): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2688,25): error TS1005: ',' expected.
../../../../node_modules/@types/react/index.d.ts(2690,13): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2691,5): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2691,6): error TS1005: ')' expected.
../../../../node_modules/@types/react/index.d.ts(2720,33): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2720,41): error TS1131: Property or signature expected.
../../../../node_modules/@types/react/index.d.ts(2721,28): error TS1005: ',' expected.
../../../../node_modules/@types/react/index.d.ts(2721,38): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2722,5): error TS1128: Declaration or statement expected.
../../../../node_modules/@types/react/index.d.ts(2761,1): error TS1128: Declaration or statement expected.
../../../../node_modules/@types/react/index.d.ts(2765,32): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2765,43): error TS1005: ')' expected.
../../../../node_modules/@types/react/index.d.ts(2765,71): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2765,73): error TS1128: Declaration or statement expected.
../../../../node_modules/@types/react/index.d.ts(2765,80): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2767,71): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2767,96): error TS1128: Declaration or statement expected.
../../../../node_modules/@types/react/index.d.ts(2767,104): error TS1005: ',' expected.
../../../../node_modules/@types/react/index.d.ts(2773,7): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2775,27): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(2777,20): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2777,34): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2779,17): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(2781,17): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2783,17): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2784,9): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2784,16): error TS1005: ')' expected.
../../../../node_modules/@types/react/index.d.ts(2790,27): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2791,14): error TS1005: ':' expected.
../../../../node_modules/@types/react/index.d.ts(2791,28): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2792,9): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(2793,9): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2794,9): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2795,5): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2795,12): error TS1005: ')' expected.
../../../../node_modules/@types/react/index.d.ts(2797,39): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2797,66): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2797,89): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2798,5): error TS1128: Declaration or statement expected.
../../../../node_modules/@types/react/index.d.ts(2799,5): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2799,9): error TS1005: ',' expected.
../../../../node_modules/@types/react/index.d.ts(2799,36): error TS1005: ',' expected.
../../../../node_modules/@types/react/index.d.ts(2799,37): error TS1005: ':' expected.
../../../../node_modules/@types/react/index.d.ts(2801,9): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2801,13): error TS1005: ',' expected.
../../../../node_modules/@types/react/index.d.ts(2801,43): error TS1005: ',' expected.
../../../../node_modules/@types/react/index.d.ts(2801,44): error TS1005: ':' expected.
../../../../node_modules/@types/react/index.d.ts(2803,13): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2803,16): error TS1005: ')' expected.
../../../../node_modules/@types/react/index.d.ts(2817,49): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2817,89): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2817,92): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(2817,126): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2818,13): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(2818,17): error TS1005: ':' expected.
../../../../node_modules/@types/react/index.d.ts(2818,57): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2818,60): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(2818,94): error TS1005: ';' expected.
../../../../node_modules/@types/react/index.d.ts(2819,17): error TS1109: Expression expected.
../../../../node_modules/@types/react/index.d.ts(2820,17): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2821,13): error TS1005: '(' expected.
../../../../node_modules/@types/react/index.d.ts(2821,43): error TS1005: '(' expected.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! Multiplayer-game@1.0.0 prestart: npm i && tsc -p ./
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the Multiplayer-game@1.0.0 prestart script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jonat\AppData\Roaming\npm-cache_logs\2019-07-16T00_34_16_693Z-debug.log`
please help me fix this issue. I had fun and enjoyed your book but I'm getting frustrated with it not working for me. I'm sure it's something I did myself but the above error was from your chapter/7 branch.

@RedHoodJT1988 I am glad you have enjoyed the book and it sucks that you have ran into this issue, it definitely ruins the experience when one runs into these issues.

I have been able to reproduce a different error once. Which also had to do with packages being outdated. Completely defeats the purpose of having a package-lock file. This happened with running the project on a node12 version. So think I will lock the project's node engine down to 10.x.x. Node is proven to be an extremely fragile ecosystem since it moves so fast.

What I find odd is when I look at your error logs... The code is complaining about react and prop-types. Since this project is not based on react at all ๐Ÿค”

Can you try removing your package-lock.json and your node_modules then running npm i && npm start again for chapter 7?

Have a feeling, npm is conflicting with your globals.

@RedHoodJT1988 Any update on your end?

@RedHoodJT1988 oh man... Good luck. No rush. Health should definitely come above everything else. I am here if you want to look at it in the future.

Thanks for testing!

Yeah the print book is still the old version and has the error. The publisher only prints one version of the book. But the PDF should be rectified. Another community member found the Errata as well and is mentioned in the known issues part of the readme in this Repo.

I'll add it here in case some other person hits the same issue

Known issues
Currently when a ship gets destroyed, the window just refreshes with location.reload(). Updating this code with location.reload(true) will fix the issue where the reload causes just a black screen to appear. This forces the browser to reload all assets instead of partially reloading them, which in turn fixes the bug. This branch includes the fix, but in the book the issue is still there.
"Listing 4-16. src/client/controls/keyboard.model.ts" should be "src/client/controls/keyboard.class.ts"
"Listing 5-2 player.class.ts" should be "game.class.ts"

Let's schedule a call where we can pair to solve your NPM issue. On skype you can reach me on oscar.lodriguez. After this i'll add the fix to this thread if someone else has encountered it.

Hello, sorry for being away from this issue for awhile. I have been dealing with a few things at work and some Python related things on my free time. I finally have some time to back to this project and was hoping that you were still available to help. I don't have Skype however I do use Slack as well as Zoom. I decided to delete the version I had and go back through the book just skimming through it to see if I can make sense of everything and for the most part I do. However when I pull down your code from the github repo and I checkout the final chapter/7 branch and run npm start, when it starts up I receive a ton of errors, I won't post them her since it's quite a bit, and I have no way of knowing how to fix the errors. I have been very excited about this building out this game but it seems like it's not in the cards for me.

Hey @RedHoodJT1988, Python is awesome.
Let's definitely schedule a Zoom call and see if we can solve it together. I have just tested it on a Linux and a Mac and it appears to work as intended. I have access to a windows PC tonight, so I could probably test it against Windows as well.

Do you have the same errors when running against develop? And are they the same errors as before? (React prop types related)

for zoom: o.lodriguez@gmail.com

Sure, ill add the game to a docker image in the meantime, think that will remove any system differences if there are any and lets us get to the bottom of things quicker.

@RedHoodJT1988 hello,

Check this https://github.com/code0wl/Multiplayer-Phaser-game/tree/chapter7/docker for the docker instance of chapter 7. I've updated the readme with a minimalist setup. Let me know if you need assistance setting this up.

@RedHoodJT1988 Thanks great!
I think it might have something to do with your global node installation. Maybe reinstalling node would fix the issue, but would need to debug further to find out. I'll close this issue. If there are more issues, we can look at it in a new github issue