Search code examples
vuepress

Vuepress Unexpected Token


I recently installed vuepress globally with

npm install -g vuepress  

And when I run vuepress -v it shows 0.10.1
But when I run vuepress dev it shows:

/usr/local/lib/node_modules/vuepress/bin/vuepress.js:17
const { dev, build, eject } = require('../lib')
  ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

Solution

  • I had the same problem just now and it was caused by an outdated node js version.

    Maybe you should check you node version with node -v

    According to https://vuepress.vuejs.org/

    VuePress requires Node.js >= 8.