StiliyanKushev / csgo-tradeup-cli

A Command Line Tool for generating profitable CSGO trade-ups using the genetic algorithm.
25 stars 2 forks source link

TypeError #11

Closed NORXONDOR closed 1 year ago

NORXONDOR commented 1 year ago

node index --noLoss --sources 4

file:///C:/Users/Username/Desktop/csgotradeup/csgo-tradeup-cli/prediction/agent.js:161 if(returnString) rarities = rarities.reduce((p,c) => p+'\n'+c); ^

TypeError: Reduce of empty array with no initial value at Array.reduce () at Agent.getCommonRarities (file:///C:/Users/Username/Desktop/csgotradeup/csgo-tradeup-cli/prediction /agent.js:161:46) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Agent.handleInputSources (file:///C:/Users/Username/Desktop/csgotradeup/csgo-tradeup-cli/pre diction/agent.js:250:39) at async Agent.init (file:///C:/Users/Username/Desktop/csgotradeup/csgo-tradeup-cli/prediction/agent. js:82:21) at async Promise.all (index 0) at async Promise.all (index 0) at async handleGeneticAlgoritm (file:///C:/Users/Username/Desktop/csgotradeup/csgo-tradeup-cli/predic tion/index.js:49:14) at async main (file:///C:/Users/Username/Desktop/csgotradeup/csgo-tradeup-cli/prediction/index.js:17: 5) at async file:///C:/Users/Username/Desktop/csgotradeup/csgo-tradeup-cli/index.js:28:5

Node.js v18.15.0

StiliyanKushev commented 1 year ago

I am unable to reproduce this issue with the provided command. Have you possibly made any local changes on your end?

NORXONDOR commented 1 year ago

I just deleted all the files, reinstalled through Git Bash following the 'Usage' section found here exactly and retried the command node index --noLoss --sources 4 with the same result as before.

I get: "Database is empty. Building database...", then "Building the database. This may take a few minutes.", followed by the timer, "Clearing the database.", "Done." and then the "now scraping: Case Name" logs, terminating with "[#] scraping data finished!", "Database has been updated." and finally the error message reported before. I have not made any local changes on my end.

I've never used MongoDB or NodeJS before so maybe I did something wrong, but I installed them as per the 'Requirements' section, following exactly.

StiliyanKushev commented 1 year ago

What platform are you on? Linux, Mac, Windows? I'm attempting to reproduce now, but I'm unable to do so.

StiliyanKushev commented 1 year ago

I'm able to reproduce the same exact error if I use node index --sources 0

StiliyanKushev commented 1 year ago

I've added some helpful messages that should clear things up. Please reopen if the issue still persists.