Creating project with angular-cli takes a long time
Solution 1
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
Solution 2
It is by far faster to use:
ng new myProject --skip-install=true
cd myProject
npm install
Solution 3
If you are using latest angular-cli
tool then use the following command.
$ ng new <project name> --skip-install=true
This will avoid npm to install all the required dependencies.
Solution 4
Run following two commands -
ng new project_name --skip-npm
//Only create project structure.
npm install
//To install all necessary packages.
stackinfostack
Updated on July 29, 2021Comments
-
stackinfostack over 2 years
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 timeng new
is run. Is there a way to create subsequent new projects without having to re-download all the dependencies? -
stackinfostack over 7 yearsHi Filldes , Thanks for your reply...... I am facing one problems here 1) After running new new project_name --skip-npm.... Which working fine but after copying the node_modules and running npm install.... Again it is taking time .... What actually i want after creating project, Project should directly run by ng serve command..
-
Fiddles over 7 years@stackinfostack if you're confident that all the libraries are there and up-to-date, you should be able to skip the
npm install
and just runng serve
. -
Julia over 6 yearsGot this message: The option '--skip-npm' is not registered with the new command. Run
ng new --help
for a list of supported options. -
Fiddles over 6 years@Julia the command option might've changed in recent release. I'll check
-
John Donn about 6 yearsJust run ng new myproject with the latest version of @angular/cli. The result is: "added 1457 projects in 287.624 seconds".. This is just insane.. And it does not seem to cache anything but does this 287 seconds insanity for every new project! Just compare this with creating a new project with Maven..
-
Vikas Kandari about 4 yearsbut to run the project you need dependencies so at the end you have to install them and its gonna take same time as there whole lot of them
-
Harsha almost 3 years--skip-npm not working. --skip-install=true worked fine.