In case others come here with this issue as I have, here is how I solved it system-wide on MacOS. Hope this helps.
Verify node is installed:
$ node -v
v11.2.0
Verify npm is installed:
$ npm -v
6.4.1
Verify your npm global install file path is configured (known as prefix). Mine is under ~/.npm-packages:
$ npm config ls -l | grep prefix
prefix = "/Users/christiangroleau/.npm-packages"
If not, you can place it into your ~/.npmrc file:
echo prefix=~/.npm-packages >> ~/.npmrc
Verify that your prefix path is listed in your system PATH:
$ echo $PATH
/Users/christiangroleau/.npm-packages/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
If not, invoke the following:
export PATH="$HOME/.npm-packages/bin:$PATH"
Finally, you can reinstall angular-cli (in my case I needed to install it globally):
$ npm install -g @angular/cli
Verify installation:
$ ng -v
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…