Can someone help me with a step by step guide to install AngularJS on Ubuntu.
3 Answers
You need to have nodejs and npm installed:
sudo apt install nodejs npm
Note that this will install nodejs 4 and npm 3, but for plain angularjs this should be enough.
Then, in a node package (you can create one by running npm init in a directory, if you don't have any yet), install the angularjs module using
npm install --save angular
- 110,243
Follow these steps:
Install nodejs and npm in latest version (simple no need to explain it). For installing the latest versions of both: How to install the latest versions of NodeJS and NPM?
For angular run these commands in the terminal:
npm install -g angular-cli ng new Project_Name cd Project_Name ng serve # ng serve will start the server by looking at some config file.Check on
localhost:4200it shows "app works".
- 122,292
- 133
- 301
- 332
To install Angular JS, make sure your PC has a stable version(LTS version) of NodeJS and npm installed.
To check for Node and npm:
- Open your terminal or press
Ctrl + Alt + T - Run
node -v - Run
npm -v
If not found, first install NodeJS. Or if older version as compared to the LTS version, first uninstall the older version and then follow these steps:
Node.js v12.x:
NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 6.x on older distros
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
Also, if you want any other version of Node, click this link: Github NodeJS
Now, you can install Angular
npm install -g @angular/cli
This will install the latest version of Angular.
If you need an older version:
npm -g install @angular/cli@1.5
or
npm -g install @angular/cli@2
or
npm -g install @angular/cli@1
or
npm -g install @angular/cli@5
.
.
NOTE: Having older version of node and installing Angular,
ng -vwill return:
After installing AngularJS check with: ng version
The result should be like this: 
Namaste
- 381
