I am using Ubuntu 18 and want to start the Angular 5 project and therefore I installed Node, npm, TypeScript and finally the latest stable Angular CLI by below command,
sudo npm install -g @angular/cli
So, by default it is downloading the latest stable Angular CLI, which is now 6.1.3 and it's by default serve the Angular 6 version instead of Angular 5, which is my requirement.
There after I searched so many pages on same to get the right CLI version for the latest version 5.2.11 for Angular 5.
Also watched many post but many are from last year 2017, when the Angular 5 were newly published.
So my issue is to get Angular 5 latest version by installing which earlier version of Angular CLI?
OS: Ubuntu 18 (Linux)
Note: use sudo
as prefix for installing. Windows user open the cmd as administrator.
sudo apt-get update
Installing NodeJS 8.11.3 LTS
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v
v8.11.3
npm is installed with Node.js
npm is distributed with Node.js- which means that when you download Node.js, you automatically get npm installed on your computer.
npm -v
6.3.0
Get TypeScript
sudo npm install -g typescript
tsc -v
Version 3.0.1
Use root to install angular/cli
sudo -s
root@ubuntu:~#
Use CLI version 1.6.6 for Angular 5.2.11
root@ubuntu:~# npm install -g @angular/[email protected]
// it will download files and take some minutes
root@ubuntu:~# ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.6.6
Node: 8.11.3
OS: linux x64
Angular:
...
Now, exit from root
exit
// reach where you want to create your new project
ng new angular5App
// it will download files and take some minutes
reach inside project directory
cd angular5App
// check project dependencies from package.json
compile, bundle and run the project
ng serve -on
by default, your project will run on http://localhost:4200/
In Chrome 65 of above version, go to Inspect, Elements,
Inside <body>
check <app-root _nghost-c0="" ng-version="5.2.11">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With