如何在没有互联网的情况下安装angular-cli [英] How to install angular-cli without internet

查看:357
本文介绍了如何在没有互联网的情况下安装angular-cli的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果只有zip文件可通过以下方式安装angular-cli-如何在没有互联网连接的情况下进行安装?

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

推荐答案

使用该ZIP ,只有您将无法实现.

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

由于在bin文件夹中,ng仍然需要一些依赖项.

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

为此:

  • Download the zip from the official repo: https://github.com/angular/angular-cli/archive/master.zip
  • Unzip it and go into that folder
  • Run npm install or yarn
  • Zip the whole folder again

现在,如果您通过以下方式共享该zip,就可以在脱机计算机上运行CLI:
-解压缩带有node_modules的CLI文件夹
-/path/to/the/folder/bin/ng new my-project

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:

在在线计算机上:
-安装@ angular/cli yarn global add @angular/cli(或使用您的zip)
-在线时创建一个新的空项目:ng new base-project
(等待yarn installnpm install完成)
-压缩node_modules文件夹,即新项目中的一个文件夹
(例如,作为node_modules_backup.zip的文件,请准备好自己……我想这将花费很长时间)

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)

在脱机计算机上
-共享新项目中的ZIP(例如USB) -创建项目:/path/to/the/folder/bin/ng new my-project --skip-install
-将node_modules_backup.zip解压缩到新创建的项目中

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

现在运行/path/to/the/folder/bin/ng serve应该可以.

这篇关于如何在没有互联网的情况下安装angular-cli的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆