Jay*_*way 10 angular-cli angular
如果您只有zip文件来安装angular-cli - 如何在没有互联网连接的情况下安装?
只有这个ZIP,你才能实现这一目标.
因为在bin文件夹中,ng仍然需要一些依赖项.
为了做到这一点:
npm install或yarn现在,如果通过执行以下操作共享该zip,您将能够在脱机计算机上运行CLI:
- 将CLI文件夹与其中的node_modules解压缩
-/path/to/the/folder/bin/ng new my-project
但.由于此计算机处于脱机状态,您只能在不安装所需依赖项的情况下构建新项目.
现在,如果您想在该离线计算机上构建项目,您还需要更多内容:
在线计算机上:
- install @ angular/cli yarn global add @angular/cli(或使用你的zip)
- 在线创建一个新的空项目:( ng new base-project
等待yarn install或npm install完成)
- 压缩node_modules文件夹,即新项目中的文件夹
(如node_modules_backup.zip)为了前,并支撑自己......我猜这需要很长时间)
在离线计算机上
- 从新项目共享ZIP(使用USB for ex) - 创建项目:/path/to/the/folder/bin/ng new my-project --skip-install
- 将node_modules_backup.zip解压缩到新创建的项目中
现在运行/path/to/the/folder/bin/ng serve应该工作.
小智 5
----在线机-----
----离线机器------
npm i @angular/cli -g --cache MY_CACHE_FOLDER --cache-min 999999999 --no-shrinkwrap
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22516 次 |
| 最近记录: |