Why are you making a mistake when executing the code via Node?

Asked

Viewed 130 times

-3

I’m having trouble running a specific code through Vscode. I have Node v4.2.6 installed and NPM v3.5.2 and when I will run via Node the code: Let pais = 'Brazil' console.log(any) Gives an error message in the log: (Function (Exports, require, module, __filename, __dirname) { Let qualquer = 'Legal' ^^^

Syntaxerror: Block-scoped declarations (Let, const, Function, class) not yet supported Outside Strict mode at Exports.runInThisContext (vm.js:53:16) At Module. _Compile (module.js:374:25) At object.Module. _Extensions.. js (module.js:417:10) at Module.load (module.js:344:32) At function.Module. _load (module.js:301:12) At Function.Module.runMain (module.js:442:10) at startup (Ode.js:136:18) at Node.js:966:3

2 answers

0

Hello, This version of Node may not accept "Let", try using var to test. Something like this:

module.exports = funciona () {  
   ...
   var pais = 'Brasil' 
   console.log(qualquer) 
}

0

I think your Node does not accept Let because it is in an old version, try updating the version of Node and test your code again.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.