Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![christian gamboa](https://secure.gravatar.com/avatar/3d9d0215f5f75a6e6013dd79966afd55?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
christian gamboa
10,097 PointsWhy is the same code throwing syntax errors in terminal /Mac ?
Running the same code in terminal, throws the following errors: constructor({ name, age, interestLevel = 5 } = {}) { ^
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
Is there anything wrong with my version of node (4.6.1)? Will these lessons become more useful when I get to use a framework ?
1 Answer
![andren](https://secure.gravatar.com/avatar/229e60726cd92951c31d7303e40be2cd?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
andren
28,558 PointsThe error is likely caused by the version of node you are using. Node did not get full support (well 99% support) for ES2015 until version 6.
You can see a list of ES2015 features that various versions of Node supports on this page. According to that page version 4 only supported about 57% of the ES2015 feature set, and destructuring is one of the features not supported at all.
So you should upgrade to at least the newest LTS release (Version 6.11.1) if you plan on using ES2015 features.