cozuya / secret-hitler

A web adaptation of the social deduction board game Secret Hitler. https://secrethitler.io
Other
839 stars 202 forks source link

Code Testing Issues in localhost #485

Closed ghost closed 6 years ago

ghost commented 6 years ago

The way the code currently stands is that when you run on npm node.js to test code that there is a difficult piece that pops up in node_modules url_parser.js line 90 regarding double colon error in host IP or something like that during the nodemon bin/dev line portion, something you have to change each new git clone command run set up you do.. can be a bit of a hassle for coders as well as other development errors that occur with npm rather than code during testing and working on issues to improve site functions...

cozuya commented 6 years ago

yeah I've noticed that too can't remember what the solution is, I'll look into it.

ghost commented 6 years ago

here is something I have that has worked for me: (Lines 87-92) secret-hitler\node-modules\mongodb\lib\url_parser.js (only line 90 is different from what is made. I think you don't get this folder until u run npm commands; not default in master ... but here:

for(i = 0; i < hosts.length; i++) { var r = parser.parse(f('mongodb://%s', hosts[i].trim())); if(r.path && r.path.indexOf(':') != -1) { hosts[i]='localhost:27017/secret-hitler-app'; } }

cozuya commented 6 years ago

Do you have a .env file with

MONGOPORT=27017

in it?

ghost commented 6 years ago

But I think the real problem is that when u run on localhost u have ur IP listed as ::1 when it should only be :1 but i dont know how to make the extra colon go away. This code above overrides the error and allows u to run nodemon bin/dev in cmd without crashing...

ghost commented 6 years ago

yes I do

ghost commented 6 years ago

image

ghost commented 6 years ago

this is saved to the default file where the big master file is saved that is cloned also in cmd npm

cozuya commented 6 years ago

there's an easy fix that's beyond me at the moment. I'll look into it at home in ~8 hours..

ghost commented 6 years ago

Also there a lot of weird npm warn deprecation warnings that pop throughout the process as well that seem weird like u cannot have stuff updated properly or something... I don't know if this is my problem only or if anyone who wants to test code locally suffers from these too?? and when u run gulp it says "Failed with 11 errors" and lists where they are.... not sure if any of these are big enough issues to tackle or if there is even a way or if there is a way I need to personally update.. idk & Thanks for looking into that!

cozuya commented 6 years ago

The deprecation things is dependencies having deprecations, which is nothing we can do about or worry about so ignore it. The gulp warnings/errors are eslint failures.. this is complicated but the gist of it is eslint and prettier conflict in some ways and basically eslint just needs to be told to shut up. They are not code failures so to speak, they are formatting failures.

ghost commented 6 years ago

What I have done before with the gulp issues is go into the files it wants changed a certain way and I make the revisions regardless how silly they seem just to remove the failure notice for personal satisfaction. I can make a PR with those changes so it can be this way all the time in master here if u like... but yeah on deprecations ok thx ;)

ghost commented 6 years ago

486

ghost commented 6 years ago

also here are some screenshots with running the stuff (later times after initial set up):

image

image

image

image

ghost commented 6 years ago

just so u know what it looks like for me subsequent times after initial set up. Also for nodemon bin/dev pages at the end after brief time i got a new red warning: Port 8080 is already in use [nodemon] app crashed - waiting for file changes before starting... not sure why that is happening either..?

ghost commented 6 years ago

here im gonna reclone from step 1 following readme instructions on here and show u what everything does via screenshots:

First npm window prior to anything after npm run db 27017: image image image

Second npm window just for just nodemon bin/dev: image

Next I implement my fix to this code error in the above image in IntelliJ IDEA IDE 2017.3: first current code: image now new edit for line 90 in this section: image

After doing this I go back to nodemon bin/dev page and rerun the command: image

Last page: gulp command: image

After running at least nodemon bin/dev if not also gulp, the very first npm window of npm run db 27017 changes slightly by adding more info at the bottom: here is that view image

Now localhost:8080 navigation: Home Page: image Game Page: image After making a 'coz' account and clicking changelog i sent test chat as well: (i guess name doesn't turn red until u play 50+ games or change wins to 50+ (either way), right?) image

But yeah so this is everything i think.

ghost commented 6 years ago

Now I will close all these windows and insert my PRs that I have on here into my local code and show u how it runs especially with gulp eslint stuff:

First npm window: just cd s-h and then npm run db 27017: image

Second npm window: cd s-h and then nodemon bin/dev: image (SO apparently one of my "fixes" for eslint is bad as this error is new....) Now having revised this issue, I will now rerun the command to have this window work right: image (SO it is so awesome I did not have to physically rerun anything it fixed this page when I fixed code. SO one error I think will remain in next window for gulp eslint.)

Gulp 3rd npm window: image (SO again one of my "fixes" caused a new weird problem, but it also does not seem to actually crash this from working....)

After doing this, I decided to try and fix the code that was messed up but this happened: image

I was about to revise the code again but then this popped up at the bottom after Failure notice: image

anywho.... that part is new weird problem... but then i revised code and rerun gulp for 3rd time with this result: so 2 out of the original 10/11 errors are left unable to be fixed so I need to revise my PR image

I think the segment highlighted here always comes super late at the end of gulp even when no fail errors take place... im not sure what the issue with it is..... image

First window again with small add ons: image

Now localhost:8080 image /observe image coz logged in and one chat sent: image

theres that. take a look and let me know what u think

ghost commented 6 years ago

487 PR for gulp eslint and the weird new gulpfile.js line 32 error about .split

ghost commented 6 years ago

also if there is ever a time u need to do a down low test not in production mode I recommend using the following: image This is in Git Bash .exe not regular cmd or even npm cmd. U then could use {computerName}:8080, localhost:8080, and https://secrethitler.localtunnel.me to test in dev mode and use the localtunnel link to send to preferred helpful people testers outside of your IP via discord link send out, etc..

ghost commented 6 years ago

U would run this after u do the 3 npm cmds for db 27017, nodemon bin/dev & gulp commands.... so 4 windows of running commands, one IDE analyzing code window for local edits, and then browser to run dev or production modes in as well as edit things on github and chat with discord for a great SH.IO set up ;)

ghost commented 6 years ago

@cozuya I found out my problem: I was not moving the .env file from my actual root directory Users\natha into the \secret-hitler directory. Once I did this my problems with double colon ceased. In a new PR I just opened a couple mins ago to aid the confusion in README I addressed this by adding a clear step for others who might get stuck on this as well.... I also found only one new gulp eslint error which i have fixed regarding an extra space before a comma that is unneeded, and I also made yet another PR for the page-home.pug to match the Changelog.jsx file.