smks / nobot-examples

Nobot Examples for the book Automation with Node.js
https://medium.com/dailyjs/how-i-automated-my-job-with-node-js-94bf4e423017
Apache License 2.0
52 stars 186 forks source link

a.js unexpected token #16

Open eliassal opened 4 years ago

eliassal commented 4 years ago

Hi Shaun I am not an expert in node, I created a.js and b.js, when I run a.js I get (The ^ character is under the 2 parentheses ())

 \Automating with Node.js\node a.js
\Automating with Node.js\b.js:1
rts, require, module, __filename, __dirname ) { const arsenalFanChant = () => {
                                                                        ^
SyntaxError: Unexpected token )
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (E:\Salam\Dev\Html\Automating with Node.js\a.js:1:73)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
smksnutmeg commented 4 years ago

Hey! What node version are you running?

smksnutmeg commented 4 years ago

4.4.5 is the minimum version for using the arrow function it's complaining about 😁

eliassal commented 4 years ago

Hi, When I run node -v I get v0.12.2 Regards

smksnutmeg commented 4 years ago

Ahh yes, that is the problem. You will need to update your node version that is quite old 👍 Book requires a newer version of Node to proceed. Hope that helps!

eliassal commented 4 years ago

Ok, I upgraded and it is running fine, continued on next and created a file with the functions for GetPizza but not sure how to run this in the command line, thanks for your help