Tegos / travian-elephant-finder

Travian Animals Finder
MIT License
29 stars 15 forks source link

json error then enoent #18

Closed psx365 closed 2 years ago

psx365 commented 2 years ago

npm run collect

travian-elephant@0.0.1 collect node src/scripts/collectOasysPosition.js

C:\Users\Administrator\Desktop\travian-elephant-finder-master\node_modules\jsonfile\index.js:67 throw err ^

SyntaxError: data/oasis.json: Unexpected end of JSON input at JSON.parse () at Object.readFileSync (C:\Users\Administrator\Desktop\travian-elephant-finder-master\node_modules\jsonfile\index.js:63:17) at Object. (C:\Users\Administrator\Desktop\travian-elephant-finder-master\src\scripts\collectOasysPosition.js:8:30) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 PS C:\Users\Administrator\Desktop\travian-elephant-finder-master>

then if I place curly brackets inside the empty oasis.json file it runs but gives the different error below

Error: ENOENT: no such file or directory, open 'src/config/token.txt' at Object.openSync (node:fs:585:3) at Object.readFileSync (node:fs:453:35) at Object.getToken (C:\Users\Administrator\Desktop\travian-elephant-finder-master\src\config\index.js:39:20) at Object.getBearerHeader (C:\Users\Administrator\Desktop\travian-elephant-finder-master\src\config\index.js:43:22) at C:\Users\Administrator\Desktop\travian-elephant-finder-master\src\libs\axiosApi.js:14:27 at process.runNextTicks [as _tickCallback] (node:internal/process/task_queues:61:5) at module.exports.runLoopOnce (C:\Users\Administrator\Desktop\travian-elephant-finder-master\node_modules\deasync\index.js:64:10) at module.exports (C:\Users\Administrator\Desktop\travian-elephant-finder-master\node_modules\deasync-promise\index.js:13:9) at module.exports (C:\Users\Administrator\Desktop\travian-elephant-finder-master\node_modules\system-sleep\module.js:30:36) at Object. (C:\Users\Administrator\Desktop\travian-elephant-finder-master\src\scripts\collectOasysPosition.js:47:5) { errno: -4058, syscall: 'open', code: 'ENOENT', path: 'src/config/token.txt' }

Tegos commented 2 years ago

Hello, @psx365 . Did you follow of the instruction setup from readme ?

Setup

psx365 commented 2 years ago

Yes I did. Somehow managed to get trough those errors. Btw. I had to manually make an empty token.txt file and install an older version of node.js + use the "npm install" command. But now I am getting a lot of html codes when I run npm collect.

But I don't get how the bot can login if I don't give the pw and acc name to it. Capture

Tegos commented 2 years ago

What about antother step of readme? Can you provide your config files?

Config

Set correct configuration in:

But I don't get how the bot can login if I don't give the pw and acc name to it.

Application can work with correct cookie auth.

psx365 commented 2 years ago

.env.txt cookie.txt

Tegos commented 2 years ago

Yes, seems there are some problems, need to check updates from game.

Tegos commented 2 years ago

add some fixes. reinstall app, and use yarn install, instead npm install

Tegos commented 2 years ago

Hello, @psx365. I'm waiting for your report :)

Tegos commented 2 years ago

I created an account and checked the wrork of the tool, see results. image

https://ts8.x1.europe.travian.com/karte.php?x=37&y=-172

image

psx365 commented 2 years ago

I am going to check it today. Last time I tested after the "npm run collect" command it was frozen and did nothing.

Update: It works I get the datas that I need, but the excel files are empty.

Tegos commented 2 years ago

Hello, @psx365 Did you figure out with configurations? You run npm run find and get empty excel file? There are two options: you set wrong configurations or there are no elephants.

bitschak commented 2 years ago

Hi! I encountered with the same issue as above. When I try to 'run collect' says the following:

PS C:\Users\user\Documents\GitHub\travian-elephant-finder> npm run collect

travian-elephant@0.0.4 collect node src/scripts/collectOasysPosition.js

C:\Users\user\Documents\GitHub\travian-elephant-finder\node_modules\jsonfile\index.js:67 throw err ^

SyntaxError: data/oasis.json: Unexpected end of JSON input at JSON.parse () at Object.readFileSync (C:\Users\User\Documents\GitHub\travian-elephant-finder\node_modules\jsonfile\index.js:63:17) at Object. (C:\Users\User\Documents\GitHub\travian-elephant-finder\src\scripts\collectOasysPosition.js:11:30) at Module._compile (node:internal/modules/cjs/loader:1097:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10) at Module.load (node:internal/modules/cjs/loader:975:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47

Node.js v17.6.0 PS C:\Users\user\Documents\GitHub\travian-elephant-finder>

How did you resolve the problem? Thanks!

Tegos commented 2 years ago

Hello @bitschak . It is a stale issue. Create a new issue if the error still exists.