node-sparkbot-samples icon indicating copy to clipboard operation
node-sparkbot-samples copied to clipboard

Unexpected Identifier

Open tanthony2020 opened this issue 4 years ago • 7 comments

I followed the instructions on DevNet and I get error below when I try to run it. I have the latest node installed. I have git installed I am not using an node.js IDE.

set DEBUG=sparkbot*,samples* set ACCESS_TOKEN={mytoken} // yes I used my real token node examples\helloworld.js

let email = command.message.personEmail; // User that created the message ^^^^^ SyntaxError: Unexpected identifier 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 Function.Module.runMain (module.js:501:10) at startup (node.js:129:16) at node.js:814:3

tanthony2020 avatar Jul 08 '21 18:07 tanthony2020

The let keyword was introduced for Node.js in v4.x, which is many years old. Can you try updating Node to a recent version (e.g. LTS v14?)

dstaudt avatar Jul 08 '21 18:07 dstaudt

The let keyword was introduced for Node.js in v4.x, which is many years old. Can you try updating Node to a recent version (e.g. LTS v14?)

I have the latest from their website. I'm not sure why you say v4.x when I do node -v I get v0.12.2.

tanthony2020 avatar Jul 08 '21 18:07 tanthony2020

The let keyword was introduced for Node.js in v4.x, which is many years old. Can you try updating Node to a recent version (e.g. LTS v14?)

I literally installed 14.17.3 yet it says v0.12.2 when I check version. I don't know what's going on

tanthony2020 avatar Jul 08 '21 19:07 tanthony2020

What environment are you using/how is node being launched? It seems like there is some confusion on how the app is being launched with respect to which node version is used, and/or how/where different node versions are installed?

dstaudt avatar Jul 08 '21 19:07 dstaudt

Yea I can’t run any of these samples. I am following exactly how it says to do it in Cisco DevNet.

Sent from my iPad

On Jul 8, 2021, at 3:35 PM, dstaudt @.***> wrote:

 What environment are you using/how is node being launched? It seems like there is some confusion on how the app is being launched with respect to which node version is used, and/or how/where different node versions are installed?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

tanthony2020 avatar Jul 08 '21 19:07 tanthony2020

What environment are you using/how is node being launched? It seems like there is some confusion on how the app is being launched with respect to which node version is used, and/or how/where different node versions are installed?

I wonder when the last time these scripts were ran by whoever created them. I skipped this module and went to the next one adn I had to modify a few things to get certain things to work and then now I'm stuck on something else. These do not run as they are instructed in the module.

I am a C#/Java developer and trying to learn Node/Python and these scripts do not run as instructed.

tanthony2020 avatar Jul 08 '21 20:07 tanthony2020

For example. I am doing the chatops one and if I run it passing in the arguments it runs fine. If I do what the instructions say and add my arguments into the launch.json it won't run anymore. It says "import requests" ModuleNotFoundError, but if I run it from command line passing arguments it's found. Doesn't make much sense to me.

tanthony2020 avatar Jul 08 '21 20:07 tanthony2020