Creating project with angular-cli takes a long time

24,930

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.

Share:
24,930
stackinfostack
Author by

stackinfostack

Updated on July 29, 2021

Comments

  • stackinfostack
    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 time ng new is run. Is there a way to create subsequent new projects without having to re-download all the dependencies?

  • stackinfostack
    stackinfostack over 7 years
    Hi 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
    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 run ng serve.
  • Julia
    Julia over 6 years
    Got this message: The option '--skip-npm' is not registered with the new command. Run ng new --help for a list of supported options.
  • Fiddles
    Fiddles over 6 years
    @Julia the command option might've changed in recent release. I'll check
  • John Donn
    John Donn about 6 years
    Just 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
    Vikas Kandari about 4 years
    but 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
    Harsha almost 3 years
    --skip-npm not working. --skip-install=true worked fine.