[Fixed] How to install angular-cli without internet


If you only have the zip file to install angular-cli with – how can it be installed without an internet connection?


With that ZIP only you will not be able to achieve that.

Because within the bin folder, the ng still needs some dependencies.

In order to do that:

Now you’ll be able to run the CLI on an offline computer if you share that zip by doing:
– Unzip the CLI folder with the node_modules in it
/path/to/the/folder/bin/ng new my-project

BUT. As this computer is offline, you’ll only be able to scaffold a new project without installing it’s required dependencies.

Now, if you want to build a project on that offline computer, you’ll need something more:

On the online computer:
– install @angular/cli yarn global add @angular/cli (or use your zip)
– create a new empty project while online: ng new base-project
(wait for yarn install or npm install to finish)
– zip the node_modules folder, the one within the new project
(as node_modules_backup.zip for ex, and brace yourself… It’s going to take a long time I guess)

On the offline computer
– Share the ZIP from the new project (with USB for ex)
– Create your project: /path/to/the/folder/bin/ng new my-project --skip-install
– Unzip the node_modules_backup.zip into the newly created project

Now running /path/to/the/folder/bin/ng serve should work.

Leave a Reply

(*) Required, Your email will not be published