Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular2 cli hangs while creating a new app

I am trying to create a new Angular2 app using

ng new myAppName

This hangs on the line

/ Installing packages for tooling via npm   

Its been sitting there for about an hour.

The previous time this happend I killed the process and tried re-running

ng new xxx

That failed because angular cli had some reference to the app name somewhere and thats whay I had to choose a new app name.

How do I get around this?

like image 263
developer747 Avatar asked Jun 15 '16 16:06

developer747


People also ask

Why is NG serve taking so long?

This is mostly because of bulky source map files. When you do ng serve , Angular serves the app from memory instead of the dist folder (the file system). This means the entire code (along with map files) will be loaded into the system's memory and this is the main reason why your system or IDE getting slow.

Which CLI is used to create a new angular project?

We use Angular CLI to help us to create the app. The Angular has come a long way since its first version in Angular 2. The creation of a new project is now as simple as installing Angular CLI and running the ng new command.

Why is NG not working?

Error 1: 'ng' is not recognized 'ng' is not recognized as an internal or external command. This error is simply telling you that Angular CLI is either not installed or not added to the PATH. To solve this error, first, make sure you're running Node 6.9 or higher.


1 Answers

I was having the same issue. I resolved by using yarn. Follow below steps

  1. Install yarn through npm using the below command

    npm install yarn --global

  2. Create your application using ng new but skip installing packages using the below command. You can install them manually using yarn

    ng new project-name --skip-install

  3. cd project-name

  4. yarn install This will install your dependencies super-fast

like image 50
rudrasiva86 Avatar answered Oct 04 '22 15:10

rudrasiva86