4

I'm trying to install Angular on macOS. I have npm 5.6.0 and node 8.11.1 installed. I tried sudo npm install -g @angular/cli, which seems to install it. However, when I type ng --version, I get:

Unknown error: ReferenceError: Invalid left-hand side in assignment

Edit: I also tried this, to no effect:

  • npm uninstall -g angular-cli

  • npm cache clean or npm cache verify (if npm > 5)

  • npm install -g @angular/cli@latest

Alex Ljamin
  • 737
  • 8
  • 31
timber.auhani
  • 167
  • 1
  • 3
  • 7
  • 1
    maybe `sudo ng --version` – Igor May 18 '18 at 14:43
  • Also you *might* have to close and re-open your console after the initial global install – Igor May 18 '18 at 14:45
  • sudo ng --version doesn't change anything, and it wouldn't be acceptable to run it as an admin anyway. I also tried reopening the console, to no effect – timber.auhani May 18 '18 at 14:46
  • Feel free to ask me more questions rather than downvoting my question. I don't really know what else to describe, the installation should be as simple as 'npm install', which is what I did, except that it doesn't work, so I don't know where to start looking, I'm stuck. – timber.auhani May 18 '18 at 15:05
  • I can't think of any other questions. Do keep in mind that someone that responds might not be the same person(s) that down/up vote. I prefer not to down vote unless there is a poorly written question with little/no effort. In this case I just did an up vote to help you out. Good luck. – Igor May 18 '18 at 15:08
  • I wasn't talking to you in particular Igor. As a matter of fact, thank you for trying, it didn't help me but maybe it will help someone else with a problem similar to mine who reads this one day. – timber.auhani May 18 '18 at 15:29

3 Answers3

17

You can use the macOS package manager. In your terminal type:

brew install angular-cli

To confirm your version:

ng --version
teemak
  • 171
  • 1
  • 5
1

I think the best way to install angular on mac is using brew.

1.) Install brew, by typing the following command on your terminal :-

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2.) After Installing brew, then run following command :-

brew install angular-cli

After Installation, you'll see angular is successfully installed.

To check, Type Command :-

ng version
nakli_batman
  • 481
  • 8
  • 4
0

Delete npm and node, then install them via brew (works perfect on mac os).

See https://brew.sh/

Erty Seidohl
  • 4,487
  • 3
  • 33
  • 45
Ignat
  • 29
  • 1