Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating project with angular-cli takes a long time

I am using angular-cli to scaffold a new Angular2 project with ng new project_name. It takes a long time to complete, as it downloads all dependencies each time ng new is run. Is there a way to create subsequent new projects without having to re-download all the dependencies?

like image 387
stackinfostack Avatar asked Oct 26 '16 01:10

stackinfostack


People also ask

How long does it take to create Angular project?

Just run ng new myproject with the latest version of @angular/cli. The result is: "added 1457 projects in 287.624 seconds"..

How long does it take to install Angular CLI?

Installing Angular with the CLI is not a complicated process. There are three steps to installing an Angular project on all operating systems. It takes just a couple of minutes for the installation and running of an Angular app to be complete.

Why is Angular CLI so slow?

reason: In the Angular 12 version, run ng build, and now the default is production mode. This is a welcome change because it reduces the chance of inadvertently deploying a development build to a production environment, which is much slower and much larger, making it feel like Angular is very slow.


Video Answer


2 Answers

You can use ng new project_name --skip-install or ng init project_name --skip-install to not download all the additional packages right away. You could then copy the node_modules directory from an existing project template, and finally do an npm install or yarn install to make sure everything is happy, depending on your package manager.

Previous versions use ng new project_name --skip-npm or ng init project_name --skip-npm

like image 65
Fiddles Avatar answered Oct 23 '22 12:10

Fiddles


It is by far faster to use:

ng new myProject --skip-install=true cd myProject npm install 
like image 29
Kodjo Tchioffo Avatar answered Oct 23 '22 10:10

Kodjo Tchioffo