Reputation: 61
Was trying out the sample code given for graphql on the following link: http://graphql.org/graphql-js/running-an-express-graphql-server/
When i try to start the server on command line ended up with Syntax Error : Unexpected Token
The error log is as follows:
C:\Users\ssadanandappa\Desktop\temp\node\server.js:8
var { buildSchema } = require('graphql');
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3
Sorry tried out a lot of options i could lay my hands on but still the same. Newbie here, any help would be really appreciated. :)
Upvotes: 2
Views: 664
Reputation: 146
I had the same issue in a windows machine. resolved upgrading from the LTS version to the Current one.
Hope it helps
Upvotes: 2
Reputation: 46
That's really strange, check the upper lines if there's any other problem like missing a ';', not closing quotations or missing a 'var' declaration.
Check your node version too, try using the latest release.
Upvotes: 0