# lowCode-engine 本地搭建环境
## 常用网站
> * 代码: <https://github.com/alibaba/lowcode-engine>
> * demo 仓库:<https://github.com/alibaba/lowcode-demo>
> * 官网 <https://lowcode-engine.cn/>
> * 文档 <https://lowcode-engine.cn/docV2/lhggxn>
> * 白皮书 <https://developer.aliyun.com/ebook/7507>
# 基本概念
# 环境搭建
## 1. 使用的是windows系统需要安装wsl
控制面板中安装wsl

## 2. 安装ubuntu
* 搜索栏中输入 store

* 搜索ubuntu 并获取

* 安装完成后配置用户名机密码

### 2.1 将wsl ubuntu存储迁移到D盘
**导出ubuntu**
> wsl --export Ubuntu D://program//nodel//wsl//ubuntu//ubuntu.tar
**删除原C盘中的wsl系统**
> wsl --unregister Ubuntu

**导入**
>wsl --import Ubuntu D:\program\nodel\wsl\ubuntu D:\program\nodel\wsl\ubuntu\ubuntu.tar
# 3 vscode 安装wsl 插件
## **_注意:_**
> _如果wsl安装的是 wsl1, vscode通过 wsl插件链接时,会报错。 处理参看:_
> <https://blog.csdn.net/u010658816/article/details/125286545>
> 链接成功后工作目录为wsl的系统中,而不是本地windows目录;
# 4 在wsl中clone代码
## 创建工程目录
> * 命令窗口中输入 wsl 执行;进入ubuntu。创建工作目录 mkdir -p /hem/aliLowCodeEngine ;
> * 克隆代码 : git clone https://github.com/alibaba/lowcode-demo.git
> * vscode切换工作目录 /hem/aliLowCodeEngine
# 5 在wsl 上安装 nodejs
> curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
> sudo apt-get install nodejs
# 6 安装包
> 安装过程遇到了很多问题,大多是没有找到包,或者是下载不了。最后安装成功了。需要<font color=red size=4>注意2点</font>。
> * 需要配置依赖镜像服务器为: https://registry.npm.taobao.org ;
> * 最好使用 pnpm 因为最后我使用它完成了包的下载,最后成功运行的。pnpm有两个特点:速度快, 所有同版本包只会下载一次, 一次下载多处使用;
> **_pnpm安装_**
> * 官方地址: https://www.pnpm.cn/benchmarks
> * 使用npm 安装 pnpm : `npm install -g pnpm --registry=https://registry.npm.taobao.org`
> * 使用命令 : `pnpm i` 安装包
# 7 运行
> `npm start`
> 
# 8 页面正常控制台运行报错且不能预览
## 报错信息
```
root@LAPTOP-2EM9VE5L:/hem/aliLowCodeEngine/lowcode-demo-main# pnpm start
@alilc/lowcode-demo@1.0.27 start /hem/aliLowCodeEngine/lowcode-demo-main
build-scripts start --disable-reload --port 5556
@alib/build-scripts 0.1.32
ERROR Failed to compile with 1 errors 8:07:31 PM
This dependency was not found:
regenerator-runtime/runtime in ./src/preview.tsx
To install it, you can run: npm install --save regenerator-runtime/runtime
```
### 尝试使用提示命令操作
`pnpm install --save regenerator-runtime/runtime`
> 执行失败提示,大概意思是说,在 github 上未找到 regenerator-runtime/runtime。
> 处理方式参照:<https://www.qumuban.com/63014.html>
> > `npm i regenerator-runtime`
# 9 运行测试通过

## 页面预览功能可以正常使用

# 99 总结
> 至此阿里低代码引擎在本地搭建成功。 后期将会继续学习一下,怎么使用它搭建应用。
> 整个过程中主要是依赖包的下载上有较多问题,如果执行pnpm i 命令出错,建议多执行几次(或者删除node_model目录后再执行 pnpm i ),其他倒还顺利。
# 9 备注
> 白皮书已经上传至阿里云盘
> 