Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run ES6 in Node REPL?

Is there any way to run ES6 in Node REPL (Read Evaluate Print Loop)? While running ES 6 commands, I am getting error as shown in the screenshot. Appreciate if someone can help me to configure Node to run ES6 code.

enter image description here

like image 866
Prasad Honrao Avatar asked Dec 28 '25 09:12

Prasad Honrao


1 Answers

TL;DR: Upgrade Node

I have Node.js v6.0.0, which means I have all the ES6 features unlocked by default. My REPL has support for (basically) everything. Now, node v6.0.0 is currently in development, so you might not want to upgrade your production server, but if you're a developer, it's really stable enough for everyday use.

If you must use an outdated version of node, I would suggest you install n. It's a way to manage your versions of node on one machine.

Good Luck!

like image 179
bren Avatar answered Dec 30 '25 23:12

bren