Syntax error: Unexpected token ) when building Docusaurus on Node 6

Yangshun Tay

I am encountering an error when running docusaurus build on [email protected] and Node 6:

$ docusaurus-build
/home/website/node_modules/docusaurus/lib/build-files.js:31
  );
  ^
SyntaxError: Unexpected token )
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:383:7)
    at startup (bootstrap_node.js:149:9)

Basically there is code like this currently in Docusaurus:

console.log(
    chalk.red('hello world'),
);

How do I fix it?

Yangshun Tay

That error occurs because trailing commas in function calls are not supported in older versions of Node. Ensure that you are using a Node version that is 8 and above. As of Docusaurus 1.2.0, Node 6 is not supported anymore and the minimum supported version is Node 8. As stated in the documentation:

You have to be on Node >= 8.x and Yarn >= 1.5.

You could use a tool like nvm to manage your Node versions.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

syntax error near unexpected token `(' when building a docker image from dockerfile

From Dev

Syntax error unexpected token '>'

From Dev

Node, when I run package.json `bin` `command` , give me `syntax error near unexpected token `(' `

From Dev

Getting error syntax error: unexpected "("When building a C program in Docker

From Dev

Syntax Error: Token ':' is an unexpected token when passing variable to directive

From Dev

error when building veins_inet: unexpected token

From Dev

Typescript syntax error on CommonJS/Node module: Unexpected token ':' on function param

From Dev

Node.js/jade syntax error: unexpected token ;

From Dev

node js (-bash: syntax error near unexpected token `"Hello World"')

From Dev

"Syntax error: Invalid or unexpected token" running a script with node.js

From Dev

Getting "Syntax Error: Unexpected Token" when calling a function from ajax

From Java

syntax error near unexpected token '(' in bash script when selecting files

From Java

syntax error near unexpected token `do' when run with sudo

From Dev

Syntax error near unexpected token "(" when declaring arrays in bash

From Dev

Syntax error, unexpected token ")" when sending mail in laravel 8

From Dev

syntax error near unexpected token `>' when using '&>>' redirection operator

From Dev

Syntax error near unexpected token when installing Yara

From Dev

syntax error near unexpected token `newline' (when install XAlign)

From Dev

-bash: syntax error near unexpected token `(' when using lookahead and lookback?

From Dev

syntax error near unexpected token `(' when running program in cygwin

From Dev

Error: Syntax Error: Token ',' is an unexpected token

From Dev

Syntax error near unexpected token `('

From Dev

Uncaught syntax error unexpected token

From Dev

Syntax Error Hibernate - unexpected token: ON

From Dev

React Syntax Error: Unexpected Token at =

From Dev

syntax error, unexpected token "}" on PHP

From Java

Syntax error near unexpected token 'then'

From Dev

JavaScript unexpected token syntax error

From Dev

Syntax error: Unexpected token, expected ,

Related Related

  1. 1

    syntax error near unexpected token `(' when building a docker image from dockerfile

  2. 2

    Syntax error unexpected token '>'

  3. 3

    Node, when I run package.json `bin` `command` , give me `syntax error near unexpected token `(' `

  4. 4

    Getting error syntax error: unexpected "("When building a C program in Docker

  5. 5

    Syntax Error: Token ':' is an unexpected token when passing variable to directive

  6. 6

    error when building veins_inet: unexpected token

  7. 7

    Typescript syntax error on CommonJS/Node module: Unexpected token ':' on function param

  8. 8

    Node.js/jade syntax error: unexpected token ;

  9. 9

    node js (-bash: syntax error near unexpected token `"Hello World"')

  10. 10

    "Syntax error: Invalid or unexpected token" running a script with node.js

  11. 11

    Getting "Syntax Error: Unexpected Token" when calling a function from ajax

  12. 12

    syntax error near unexpected token '(' in bash script when selecting files

  13. 13

    syntax error near unexpected token `do' when run with sudo

  14. 14

    Syntax error near unexpected token "(" when declaring arrays in bash

  15. 15

    Syntax error, unexpected token ")" when sending mail in laravel 8

  16. 16

    syntax error near unexpected token `>' when using '&>>' redirection operator

  17. 17

    Syntax error near unexpected token when installing Yara

  18. 18

    syntax error near unexpected token `newline' (when install XAlign)

  19. 19

    -bash: syntax error near unexpected token `(' when using lookahead and lookback?

  20. 20

    syntax error near unexpected token `(' when running program in cygwin

  21. 21

    Error: Syntax Error: Token ',' is an unexpected token

  22. 22

    Syntax error near unexpected token `('

  23. 23

    Uncaught syntax error unexpected token

  24. 24

    Syntax Error Hibernate - unexpected token: ON

  25. 25

    React Syntax Error: Unexpected Token at =

  26. 26

    syntax error, unexpected token "}" on PHP

  27. 27

    Syntax error near unexpected token 'then'

  28. 28

    JavaScript unexpected token syntax error

  29. 29

    Syntax error: Unexpected token, expected ,

HotTag

Archive