Cant install Angular on MacOS
I can't install the framework Angular on my Mac.
macOS Mojave version 10.14.6
The terminal suggest I should be using an admin account to make this installation work.
This is what I have been using to the terminal for the install:
npm install -g @angular/cli
This is the error displayed, copying and pasting the code is not comprehensive so instead I made the snapshot.
This problem is well known on macOS machines, and is linked to how your OS protects certain directories. Here is the procedure recommended in the NPM docs:
- Back up your computer.
- On the command line, in your home directory, create a directory for global installations:
- Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
- In your preferred text editor, open or create a
~/.profilefile and add this line:
- On the command line, update your system variables:
Alternatively, you can install NodeJS and NPM using a version manager like
nvm. With both of these methods, you are simply creating and defining a new directory where all of your NPM stuff will be installed. This prevents you from having to use
sudoto install packages.
Try logging in as a super user.
sudo npm install -g @angular/cli
Hope it works!
I was able to install angular using brew. Use this link to find more about how to install Brew on your macOS, and about Angular while using brew the details are here. You only need to run
brew install angular-cliI think on the terminal, so I hope that works out for anyone else having issues regarding this frameworks installation.