nobot-examples icon indicating copy to clipboard operation
nobot-examples copied to clipboard

a.js unexpected token

Open eliassal opened this issue 5 years ago • 5 comments

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)

eliassal avatar Oct 20 '19 15:10 eliassal

Hey! What node version are you running?

smksnutmeg avatar Oct 20 '19 16:10 smksnutmeg

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

smksnutmeg avatar Oct 20 '19 16:10 smksnutmeg

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

eliassal avatar Oct 21 '19 09:10 eliassal

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!

smksnutmeg avatar Oct 21 '19 09:10 smksnutmeg

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

eliassal avatar Oct 21 '19 09:10 eliassal