node.js - ES6 import statements not working in Node v8.4.0 -
i'm using latest version of node js v8.4.0. however, in import , export statements, i'm getting errors:
import express 'express'; ^^^^^^ syntaxerror: unexpected token import @ createscript (vm.js:74:10) @ object.runinthiscontext (vm.js:116:10) @ module._compile (module.js:537:28) @ object.module._extensions..js (module.js:584:10) @ module.load (module.js:507:32) @ trymoduleload (module.js:470:12) @ function.module._load (module.js:462:3) @ function.module.runmain (module.js:609:10) @ startup (bootstrap_node.js:158:16) @ bootstrap_node.js:598:3
what node js version should install in order work these es6 codes?
- os - ubuntu 17.04
- node -v: v8.4.0
- npm -v: 5.3.0
Comments
Post a Comment