Getting ES6 features with node and nvm

Madd0g picture Madd0g · Jul 16, 2014 · Viewed 7.7k times · Source

I already had node 0.10.* and I installed nvm, then through nvm I installed 0.11.13 and 0.10 again.

node --version gives back 0.11.13

I try to use some of the ES6 features I read about and nothing I tried works.

I run my script with node --harmony index.js

...args says SyntaxError: Unexpected token .

let x = 5; also gives an error - SyntaxError: Unexpected identifier

Where can I find what's currently supported in 0.11.13?

Answer

Mritunjay picture Mritunjay · Jul 16, 2014

Try this instead

"use strict"
let x = 5;
console.log(x)

It will work.

run it like following

node --harmony file.js