2

Can someone help me with a step by step guide to install AngularJS on Ubuntu.

metalac
  • 31

3 Answers3

4

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
Byte Commander
  • 107,489
0

Follow these steps:

  1. 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?

  2. 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. 
    
  3. Check on localhost:4200 it shows "app works".

karel
  • 114,770
0

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:

  1. Open your terminal or press Ctrl + Alt + T
  2. Run node -v
  3. 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 -v will return: this warning

After installing AngularJS check with: ng version

The result should be like this: enter image description here

Namaste