1

I'm beginner React developer and have syntax error when I start yarn in atom.

I didn't edit any code before I first started yarn, but it has a syntax error. I have successfully run create-react-app using nvm and yarn in my local terminal.

This is error log in atom terminal

question Which command would you like to run?: start
$ react-scripts start
/Users/hyerimhyeon/react-tutorials/contact-app/node_modules/react-dev-utils/WebpackDevServerUtils.js:166
  compiler.hooks.done.tap('done', async stats => {
                                  ^^^^^
SyntaxError: missing ) after argument list
    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.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/hyerimhyeon/react-tutorials/contact-app/node_modules/react-scripts/scripts/start.js:45:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

How do I fix it?

tk421
  • 5,775
  • 6
  • 23
  • 34
  • You can't apply `async` to an arrow function that way. Check this answer: https://stackoverflow.com/a/42964310/751484 – Jonathan M Apr 02 '19 at 14:30
  • 1
    @JonathanM That's not correct. The [syntax is fine](https://jsfiddle.net/jrunning/peqwcmn2/3/) for an `async` arrow function with a single argument. The error message suggests, rather, that OP is running an old version of Node that doesn't support `async`/`await` at all. – Jordan Running Apr 02 '19 at 20:51

1 Answers1

1

Update your node version to at least v8 and it should run perfectly

Samiul Alam
  • 2,174
  • 4
  • 11
  • 29