mtuanp / packtpubbot

A bot for claim daily free learning ebooks from packtpub.
GNU Lesser General Public License v3.0
5 stars 5 forks source link

I am doing Something wrong but I don't know what #4

Closed PhillipMC closed 7 years ago

PhillipMC commented 7 years ago

Hello this is my packtpub.log const config = require('./config.json'); ^^^^^ SyntaxError: Use of const in strict mode. at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:906:3

*And this is my config.json in my packtpub folder user and password I have put right but here I put so with '':**

{ / Choose 'telegram' or 'pushbullet' according to your favorite way of get informed / "informBy": "", / Determines if you want do download the ebook after claim/ "downloadAfterClaim": false, / Determines where you want do download the ebook after claim If this config is null, the file will be download at same directory as index.js / "outputDirectory": null, "dowloadFormat": "pdf", "packtpub": { "email": "phillipm*@**.com", "password": "**" }, "pushbullet": { "apiKey": "" }, / to use telegram, you have to create a bot first. See: https://core.telegram.org/bots#3-how-do-i-create-a-bot / "telegram": { "botToken" : "", "receiverId" : "" } }

MaikeMota commented 7 years ago

Hello @PhillipMC, what is your node version?

Withing a google research i found some people having the same issue with another programs/libraries and they solved by updating the node version.

Please, take a look at http://stackoverflow.com/questions/36789889/syntaxerror-use-of-const-in-strict-mode

PhillipMC commented 7 years ago

thanks @MaikeMota I fixed it that mistake but now I have another one. My config.json is the same like before. I changed nothing except I've updated my node version with the commands of your link in stackoverflow.

this is the output of my /var/log/packtpub.log:

/config.json: Unexpected token / in JSON at position 4 at JSON.parse () at Object.Module._extensions..json (module.js:588:27) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at Object. (/packtpub/index.js:3:16) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) **And this is my output when I put "_npm start_" in console:** npm ERR! Linux 4.4.50-v7+ npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" npm ERR! node v7.8.0 npm ERR! npm v4.2.0 npm ERR! path /package.json npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open '//package.json' npm ERR! enoent ENOENT: no such file or directory, open '/package.json' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent npm ERR! Please include the following file with any support request: npm ERR! /.npm/_logs/2017-04-15T13_03_42_490Z-debug.log
mtuanp commented 7 years ago

Hi @PhillipMC I think your config.json is false. Please delete all comments. Please try this config file and put your email and password.

config.zip

PhillipMC commented 7 years ago

Finally I achieve that the bot works fine :+1: I am very grateful. Only say if there is something who don't turn on this project and I changed my crontab after update to: /usr/bin/node to /usr/local/bin/node and I copied the config.json of the website and changed the parameters, because in a first moment I changed the template and that was the problem like say @mtuanp. Thanks again.

mtuanp commented 7 years ago

You're welcome @PhillipMC.