'Gradle sync failed in Android Studio processRequest = (req, res, next) => {

I just come across this issue in a newly created react native project. I'm using node 14.17.0 via nvm. And running yarn start worked just fine from the Mac terminal. But syncing project in Android Studio still failed. Any help?

/Users/me/project/node_modules/metro/src/Server.js:350
  processRequest = (req, res, next) => {
                 ^

SyntaxError: Unexpected token =
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Users/me/project/node_modules/metro/src/shared/output/bundle.js:12:16)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)


Solution 1:[1]

I solved this problem with this command in the terminal

sudo ln -s $(which node) /usr/local/bin/node

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ruli