Node.js application SyntaxError: Unexpected reserved word 'class'

The class declaration is an ES6 Feature. ES6 features are hardly supported in node 4.4.6. Try updating it and running npm install again

Also see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/class


I solved the problem after scratching my head for so many hours.

As @Tom M said the class declaration is an ES6 feature and previously i had node 4.2.6 but when i updated it to v4.6.2 the error vanished.

I downloaded the binary from here and install the node by extracting the file manually to my /usr/local directory and then ran

 npm install

You can find how to install node binary manually here


JavaScript classes were recently introduced in ECMAScript 6. They are syntactic sugar over the previous prototypical inheritance model.

You can check which version of node supports class syntax over node.green

You can see the class concept is supported from v4.6.2 so try to update it to at least 4.6.2.But not all the ES6 feature are supported by this version.