@angular/cli installation.

Today, I had to spent lot of time on the "@angular/cli" installation.

My improper steps ate lot of time.

To install the "@angular/cli" in Ubuntu 16.04,  I  must had to follow the below steps.
Note: Before following below steps we should install nodeJS.

Step-1  Create a directory.
             mkdir angular2-demo
          

Step-2   Install  the angular cli globally      
            npm install -g @angular/cli 
          

Now, I'm going to create project with ng command but when I type the below command, it said ng not found.

  ng --version

I realized that have to set the path for ng command, path setting should I do in environment variables('.profile' ) ?
  - Actually, I don't like this kind of settings for angular(If anyone have any other alternative please feel free to share here) :-( .
  So, temporarily  I created alias path.

      alias ng="/home/kernellora/.npm-global/lib/node_modules/@angular/cli/bin/ng"  
              If you see above path I have installed npm module in the global npm folder because while installing any npm  module I don't want to type sudo[Check here for more info].

Then I created the project with below command.
    ng new angular2-webpack-seed

Finally, my project creation succeeded.

After installing the project I noticed that it prepared all dependencies in the package.json.



Now, I can run the project with command
  npm start





No comments:

Post a Comment