-1

I'm trying Google Cloud to host my node.js app. On Windows 10 I have node v7.9.0 and on Google Cloud it's using node v6.9.0

On Windows 10 it runs flawlessly. On google cloud it gives me this error...

/app/test.js:16
client.Dispatcher.on(Events.GATEWAY_READY, e => {
                                              ^
SyntaxError: Unexpected token >

I don't get it, what's the problem here?

  • 1
    Check `process.version`. That's strange because node allows arrow functions since version 4. – Alexey Ten Apr 14 '17 at 14:47
  • 1
    That was the issue. I was following their example which said I had to declare a version, and it was an extremely low version example. After changing it, it worked. – user3459555 Apr 14 '17 at 14:49
  • I'm glad that you were able to resolve the issue. Would you please direct me to the example that you've tried? I'd like to correct the example documentation if it is from Google Cloud. – Kamran Apr 15 '17 at 18:35
  • "engines": { "node": "4.6.0" }, – user3459555 Apr 16 '17 at 20:14
  • Thanks. Do you still have link of tutorial that you followed? – Kamran Apr 16 '17 at 21:49
  • I didn't follow a tutorial. When using gcloud they give you sample code if you need it. Otherwise when making my own code you need a .js, .json and .yaml files. – user3459555 Apr 17 '17 at 10:58
  • Here is my 3 files with code - https://pastebin.com/ZXTJhKzs – user3459555 Apr 17 '17 at 10:58

1 Answers1

0

The app engine's default Node.js engine aims to be the latest LTS release. One can specify the actual version used when writing the app, if this version is needed, by editing the package.json file, as described in the "Engines" paragrapth of the "The Node.js Runtime" document. This works in the flexible environment.

George
  • 274
  • 1
  • 5