jacobtruman / nodejs_steambot

SteamBot
5 stars 3 forks source link

SyntaxError: Unexpected token { in JSON at position 145 #19

Closed DontAskM8 closed 7 years ago

DontAskM8 commented 7 years ago

This the whole error code

SyntaxError: Unexpected token { in JSON at position 145 at Object.parse (native) at Object. (C:\Users\JingYong-PC\Desktop\nodejs_steambot-master\trade_offers.js:114:16) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:393:7) at startup (bootstrap_node.js:150:9)

What is wrong here ?

// main config file if (fs.existsSync(configFile)) { var data = fs.readFileSync(configFile, 'utf8'); if (data != undefined){ config = JSON.parse(data); }else { throw Error("MISTAKE: there was a problem reading the config file: " + configFile); } } else { throw Error("MISTAKE: configFile does not exist: " + configFile); }

And if possible can someone add me on steam or facebook and teach me how to install it properly

jacobtruman commented 7 years ago

@RevivedSol, could you provide the command you are using to run the bot?

DontAskM8 commented 7 years ago

Node trade_offers.js

jacobtruman commented 7 years ago

You need to create a config file containing your user information: https://github.com/jacobtruman/nodejs_steambot/wiki

DontAskM8 commented 7 years ago

Ive already done it though, even made a folder named configs and put it in there

jacobtruman commented 7 years ago

As it says on the wiki node trade_offers.js username, where username is the name of the config file you created. If you created the file configs/RevivedSol.json, the command would be node trade_offers.js RevivedSol

DontAskM8 commented 7 years ago

Huh ? So i should do node trade_offers.js config. ?

DontAskM8 commented 7 years ago

Will try, will get back to you if there is still any issues

DontAskM8 commented 7 years ago

@jacobtruman Hmm i try reinstalling the bot and after i type npm install nodejs_steambot , it says "50 error Refusing to install nodejs_steambot as a dependency of itself" and is it possible to add me on steam? i think it will be much more easier or maybe facebook

jacobtruman commented 7 years ago

How did you go about uninstalling the bot?

DontAskM8 commented 7 years ago

@jacobtruman what do you mean ? and i can only download the depencies using npm install

jacobtruman commented 7 years ago

what did you do to uninstall it? what command did you run, or what exactly did you delete?

DontAskM8 commented 7 years ago

i deleted everything and redownload at github, the previous one's depencies were also installed using npm install

jacobtruman commented 7 years ago

Delete everything again and run npm install nodejs_steambot

https://www.npmjs.com/package/nodejs_steambot

DontAskM8 commented 7 years ago

@jacobtruman It gave me this error

npm ERR! Windows_NT 10.0.15063 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "nodejs_steambot" npm ERR! node v6.10.2 npm ERR! npm v3.10.10 npm ERR! code ENOSELF

npm ERR! Refusing to install nodejs_steambot as a dependency of itself npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request: npm ERR! C:\Users\JingYong-PC\Desktop\nodejs_steambot-master\npm-debug.log

DontAskM8 commented 7 years ago

have you found the fix ? @jacobtruman

jacobtruman commented 7 years ago

I have never run into this problem and I am inclined to think it is an issue with how npm works, and not my code. Could you try running the install in a different directory?

DontAskM8 commented 7 years ago

is it something to do with the version of my nodejs ?

jacobtruman commented 7 years ago

Not sure - a quick google search might help:

https://www.google.com/search?q=Refusing+to+install+as+a+dependency+of+itself&oq=Refusing+to+install+as+a+dependency+of+itself&aqs=chrome..69i57j0l5.3949j0j7&sourceid=chrome&ie=UTF-8

http://stackoverflow.com/questions/11940086/refusing-to-install-sqlite3-as-a-dependency-of-itself

DontAskM8 commented 7 years ago

kudos to this, it started downloading the dependices

Check if your project folder name is same as the module you are trying to install,

If you try to install express inside a project folder name express, you will get this error.

Rename your Project Folder, Your project Folder name should be unique compared to the npm module names

Also change the package.json file entry

"name": "xxxxx", "version": "1.0.0",

jpumford commented 7 years ago

This is because you are running npm install nodejs_steambot inside the steambot directory itself. If you run npm install [package], it will install [package] in the node_modules subdir

Run npm install instead of npm install nodejs_steambot. You are trying to install the project's dependencies, not the project itself.

DontAskM8 commented 7 years ago

now... when it finishes download the dependencies. it shows

npm WARN nodejssteambot@0.1.16 license should be a valid SPDX license expression

and when i try do node trade_offers.js

Error: Cannot find module 'steam-webapi

mm

jpumford commented 7 years ago

Are you running just npm install in the base directory? Which command spits out this error? steam-webapi installs fine for me.

DontAskM8 commented 7 years ago

first i do this at cmd "cd C:\Users\JingYong-PC\Desktop\nodejs_steambot-master"

Then i typed npm install

And i type node trade_offers.js

edit i went to the node modules file and copy steam-web-api and rename to steam-webapi. The error dont show anymore but this came out ... (idk why is there so many problems zz)

TypeError: Cannot read property 'key' of undefined at new tfprices (C:\Users\JingYong-PC\Desktop\nodejs_steambot-master\node_modules\tfprices\index.js:8:17) at Object. (C:\Users\JingYong-PC\Desktop\nodejs_steambot-master\trade_offers.js:155:14) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:393:7) at startup (bootstrap_node.js:150:9)

jpumford commented 7 years ago

@jacobtruman it looks like this might be due to the dependency being namespaced under @doctormckay, but it's required in as just steam-webapi and not @doctormckay/steam-webapi.

Did this dependency change recently? It could be you still have a local copy of steam-webapi so it's not failing for you.

jacobtruman commented 7 years ago

@jpumford I am not sure, I have been using without issue for more than a year. My last update (which was unrelated to steam-webapi) was 22 days ago. It looks like steam-webapi was updated a little less than a year ago.

DontAskM8 commented 7 years ago

@jacobtruman is it possible that you give me a copy of yours ? Like maybe upload to mediafire or any link

jacobtruman commented 7 years ago

It looks like I am running on version 0.6.5 of steam-webapi, which might explain that.

DontAskM8 commented 7 years ago

@jacobtruman ive download the 0.6.5 version but now another issue -_-

C:\Users\JingYong-PC\Desktop\nodejs_steambot-master\node_modules\tfprices\index.js:8 p.key = options.key; ^

TypeError: Cannot read property 'key' of undefined at new tfprices (C:\Users\JingYong-PC\Desktop\nodejs_steambot-master\node_modules\tfprices\index.js:8:17) at Object. (C:\Users\JingYong-PC\Desktop\nodejs_steambot-master\trade_offers.js:155:14) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:393:7) at startup (bootstrap_node.js:150:9)

jpumford commented 7 years ago

I get that error as well. What does npm ls | grep tfprices give you @jacobtruman?

jacobtruman commented 7 years ago

The fix is quite simple... node index.js username; the trade_offers.js file is old - I need to update the wiki.

DontAskM8 commented 7 years ago

@jacobtruman so ive download the new one and where should i put my is and ss ?

C:\Users\JingYong-PC\Desktop\tf2 bot\index.js:443 if(account_config.steam_guard.shared_secret != undefined) { ^

TypeError: Cannot read property 'shared_secret' of undefined at getLogonOptions (C:\Users\JingYong-PC\Desktop\tf2 bot\index.js:443:31) at Object. (C:\Users\JingYong-PC\Desktop\tf2 bot\index.js:132:20) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:393:7) at startup (bootstrap_node.js:150:9)

jacobtruman commented 7 years ago

That all should be auto generated and written to the config file after you put in your steam guard code.

DontAskM8 commented 7 years ago

I cant even login though, it straight away show that error. And btw which smaple config should i use ? The one with custom sel/buy order or the one needed bp.tf api ?

DontAskM8 commented 7 years ago

@jacobtruman i still couldnt login, it keeps showing the error and wont let me type my steamguard code

C:\Users\JingYong-PC\Desktop\tf2 bot\index.js:443 if(account_config.steam_guard.shared_secret != undefined) { ^

TypeError: Cannot read property 'shared_secret' of undefined at getLogonOptions (C:\Users\JingYong-PC\Desktop\tf2 bot\index.js:443:31) at Object. (C:\Users\JingYong-PC\Desktop\tf2 bot\index.js:132:20) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:393:7) at startup (bootstrap_node.js:150:9)

jacobtruman commented 7 years ago

What command are you using to start the bot?

DontAskM8 commented 7 years ago

Node index.js config

jacobtruman commented 7 years ago

You need both config.json and username.json, where username is your username. Then your command should be node index.js username where username is your username. For example: my username is jacobtruman, so the command I run is node index.js jacobtruman.

DontAskM8 commented 7 years ago

Ops forgot to tell you ive tried that too :c

jacobtruman commented 7 years ago

Ok, post your configs here - make sure you change passwords one keys.

DontAskM8 commented 7 years ago

@ok ive tried put both with the same thing { "username":"_________", "password":"________", "bot": { "item":"ITEM TO BE BOUGHT/SOLD", "purchase_price":0, "sale_price":0 } } ive also tried setting the config.json to the default one { "username":"USERNAME", "password":"PASSWORD", "bot": { "item":"ITEM TO BE BOUGHT/SOLD", "purchase_price":0, "sale_price":0 } }

DontAskM8 commented 7 years ago

@jacobtruman anything wrong with the config ?

jacobtruman commented 7 years ago

I am assuming your username is not *, and that you put your actual password in.

DontAskM8 commented 7 years ago

Huh ? I dont get it ...

jacobtruman commented 7 years ago

What is the username you use to login to steam? That is what should be in the username field. The password you use to login to steam should go in the password field. The config you posted has "*" for the username. I don't want you to post your password here, but it should be in your config file.

DontAskM8 commented 7 years ago

thats what i did though :c

DontAskM8 commented 7 years ago

@jacobtruman add me on steam steamcommunity.com/id/tokenboi i think its easier and safer or can you help me by telling me what to do 1 by 1 ?

DontAskM8 commented 7 years ago

Or maybe skype? Ill share my screen

jacobtruman commented 7 years ago

Ok, there is more that I need to document about how to setup your config - there are a few things generated when enabling steam guard that are not shown to you on your mobile device that need to be captured and added to the user config. I thought I had automated this in my script, but must not have. The problem with handling it automatically with the script is that you will no longer be able to use the steam guard codes generated on your mobile device. I will update the documentation that describes how to set this up for both your mobile device and the bot.

Stay tuned...

DontAskM8 commented 7 years ago

So its the scripts' problem?

jacobtruman commented 7 years ago

No, it's a problem with your config