Angular installation

女生的网名这么多〃 提交于 2019-12-04 10:01:24

问题


I want to install Angular version 4.* on my windows 7.
I am currently using Angular version 1.6.*

I tried following command

npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@next --save

But its not working

Can any one please guide me to install and to create angular 4 project..


回答1:


  1. Make sure you have node version above 6.9 and npm above 3
  2. Check the version by using node --version and npm --version
  3. Install angular cli using npm install -g @angular/cli
  4. -g installs the angular globally on your system and you just have to run this command only once
  5. Create the angular project using ‘ng new angularprojectname’
  6. Go to that project folder and check the angular version by ‘ng -v’
  7. Upgrade this version to angular 4 by running this command-

    For Windows- npm install @angular/common@next @angular/compiler@next @angular/compiler-cli@next @angular/core@next @angular/forms@next @angular/http@next @angular/platform-browser@next @angular/platform-browser-dynamic@next @angular/platform-server@next @angular/router@next @angular/animations@next --save

For Linux/Mac- npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@next --save

Make sure to upgrade the typescript version by running command- npm install typescript@2.2.1 --save

Ignore whatever warning it shows up and now check the angular version by ‘ng -v’ The version has changed from 2.2.4 to 4.1.0

You can also check all the info about your angular cli in package.json file.




回答2:


You just need to install npm -g install angular-cli

And write sudo if you are using mac or ubantu

Then go to directory where you want project and then ng new PROJECTNAME

It will create project

Hope it helps you




回答3:


You can refer this for full steps installing Angular 4

https://www.youtube.com/watch?v=yAJ05021nro

Steps below:

  • Install Node.js and npm: https://nodejs.org/en/download/

  • Then install the Angular CLI globally.

    npm install -g @angular/cli

  • You can check the version:

node -v

npm -v

  • Open a terminal window at that folder (shif + right click for window). ng new my-app

  • Go to the project directory and launch the server.

    cd my-app (go to folder project)

ng serve --open




回答4:


I have also found the same issue while installing.

Please Do check npm and nodejs version and upgrade them.

I'd like to recommend node v6.x.x and npm 4.x.x or higher




回答5:


If you are looking for latest angular version use this command to install

npm -g install @angular/cli




回答6:


There are many ways to structure AngularJS applications. When you begin to upgrade these applications to Angular, some will turn out to be much more easy to work with than others. There are a few key techniques and patterns that you can apply to future proof apps even before you begin the migration.

  • Follow the AngularJS Style Guide
  • Using a Module Loader
  • Migrating to TypeScript
  • Using Component Directives

  • Upgrade with ngUpgrade

Or up can follow the official document of Angular




回答7:


For installing Angular 4 follow below simple steps:

  1. Install node.js and npm(they are required dependencies. npm is automatically installed on installing node.js). You can install it from here
  2. With the help of npm install angular CLI. Type the following command in your command prompt: npm install -g @angular/cli
  3. If you are still facing some problems you have to install git. You can install it from here
  4. Now to create an angular 4 project using Angular CLI type the following command: ng new [Project_Name] This will create an Angualr 4 project. 5.To start the server and get your project up and running type following in command line: ng serve

Remember you should be inside the project folder before starting the server. Hope this helps.




回答8:


You have some libraries, Like

angular-material, angular-cdk`

etc... Add all those and Try. It will work for sure. And you will be able to run the project




回答9:


Install angular cli globally.

npm install -g @angular/cli

Get git pull from repository:-

[https://github.com/blazehub/ng-cli-starter.git]

to get ready made production ready project structure.




回答10:


I am adding this to update the answer.

If you want to install the latest angular version others answers are for you.

If you want to install a specific version of angular (Get your version number here) You should use the below command.

npm install -g @angular/cli@VERSION_NUMBER

for example, if you want to install angular 1.4.9 command should be like below

npm install -g @angular/cli@1.4.9


来源:https://stackoverflow.com/questions/43945420/angular-installation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!