I'm using the latest version of Node.js that is v8.4.0. However, in the import and export statements, I'm getting errors:
import express from 'express';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:537:28)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Function.Module.runMain (module.js:609:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:598:3
What Node.js version should I install in order to work these ES6 codes?
- OS - Ubuntu 17.04
- node -v: v8.4.0
- npm -v: 5.3.0