Unknown error: SyntaxError: Unexpected token 'export' on ng command

You are using an incompatible NodeJs version. Install a lower version.

More information here (webarchive version).

Check for node versions. use nvm brew install nvm

I had the same problem. if you have any other version of Node that might fix it On the Angular Github node requirement is below

"engines": {
    "node": ">=10.13.0 <13.0.0",
    "yarn": ">=1.22.4"

after installing the older version nvm install 12.4.0
then nvm use 12.4.0

this did the fix for me

I had the same issue and I could fix it by downgrading node to v12.8.1

You could use nvm as follows:

install nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

refresh .profile

source ~/.profile

install node v12.8.1

nvm install v12.8.1

check that you are using the 12.8.1 version

nvm list

check ng again

ng -- version