mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-29 01:02:47 +08:00
feat: windows 启动优化
This commit is contained in:
parent
1812ee50c3
commit
eed9aac2c6
@ -24,6 +24,10 @@ module.exports = {
|
|||||||
title: '开发者',
|
title: '开发者',
|
||||||
path: '/dev/',
|
path: '/dev/',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: '常见问题',
|
||||||
|
path: '/qs/',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'TODO: 原理解析',
|
title: 'TODO: 原理解析',
|
||||||
children: [
|
children: [
|
||||||
|
BIN
docs/docs/.vuepress/public/images/6.png
Normal file
BIN
docs/docs/.vuepress/public/images/6.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
99
docs/docs/qs/README.md
Normal file
99
docs/docs/qs/README.md
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
## windows 本地启动项目
|
||||||
|
**windows 项目地址目前在 `feat-win` 分支,需要切换到 `feat-win`。**
|
||||||
|
如果您是在 `windows` 系统下使用本项目进行启动的话,如果出现了一些跑不起的情况,下面的一些经验或许可以帮助您。
|
||||||
|
|
||||||
|
### 安装依赖
|
||||||
|
项目是基于 `electron-vue` 的,所以需要本地已经安装好 `nodejs`。当 `clone` 好项目到本地的时候,需要对项目依赖
|
||||||
|
进行手动安装:
|
||||||
|
```bash
|
||||||
|
$ cd rubick
|
||||||
|
$ npm install
|
||||||
|
```
|
||||||
|
由于本项目依赖 [iohook](https://wilix-team.github.io/iohook/) 和 [robotjs](http://robotjs.io/)
|
||||||
|
而这2个项目在安装时,依赖 node gyp 的编译,所以你可能会遇到一些环境问题或者网络问题。
|
||||||
|
### iohook 安装
|
||||||
|
首先,我们先来安装 `iohook`,按照 `iohook` 的文档所示,安装前需要先确定当前 `electron` 的版本以及 `abi` 的版本,
|
||||||
|
现在我们使用的 `electron` 版本是 `v11.0.2` 所以只需要在 `package,json` 中加上以下配置,指定安装特点的`.node` 文件
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"iohook": {
|
||||||
|
"targets": [
|
||||||
|
"node-83",
|
||||||
|
"electron-85"
|
||||||
|
],
|
||||||
|
"platforms": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"arches": [
|
||||||
|
"x64",
|
||||||
|
"ia32"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
接下来执行安装操作:
|
||||||
|
```shell
|
||||||
|
$ npm i iohook
|
||||||
|
```
|
||||||
|
|
||||||
|
如果此时一直停留在 `node install` 进度上,说明可能需要翻墙,这里就不介绍如何翻墙了。此时虽然 `.node` 文件没有下载成功,但是 `iohook` 源文件
|
||||||
|
已经安装成功,如果因为翻墙问题导致的安装失败,我们解决好翻墙问题后,可以接着运行一下:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ npm run rebuild_win
|
||||||
|
```
|
||||||
|
到这里 `iohook` 应该就安装好了
|
||||||
|
|
||||||
|
### 安装 robotjs
|
||||||
|
和 iohook 不同, `robotjs` 需要 `node gyp` 重新编译 `C++`。所以第一步是先安装源文件:
|
||||||
|
```shell
|
||||||
|
npm i robotjs@git+https://github.com/Toinane/robotjs.git
|
||||||
|
```
|
||||||
|
此时如果报错,大多还是因为墙的问题。不管包不报错,我们接下来都需要执行一下下面的编译操作:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm run rebuild_win
|
||||||
|
```
|
||||||
|
此时,可能会出现下这个错:
|
||||||
|
|
||||||
|
```text
|
||||||
|
gyp ERR! find VS msvs_version not set from command line or npm config
|
||||||
|
// ...
|
||||||
|
```
|
||||||
|
google 了一圈,大多数是说缺少 `visual studio`。需要安装,所以可以执行这个命令:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ npm install --global --production windows-build-tools
|
||||||
|
```
|
||||||
|
到这里会进入正常的安装流程,理论上会一部到底,如果你卡在了 `Successfully installed Python 2.7` 不动了
|
||||||
|
可以去一下 `C:\Users\you username\.windows-build-tools` 找一下看看应该会有一个 `vs_BuildTools` 文件
|
||||||
|
双击后,会出现以下弹窗:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
点击启动,如果一切正常那么可以方向关掉你的命令行了,此时 vs 已经安装成功,接下来要配置一下编译工具:
|
||||||
|
```shell
|
||||||
|
$ npm config set python python3.9
|
||||||
|
$ npm config set msvs_version 2017
|
||||||
|
```
|
||||||
|
到这里终于完事了,再执行一下 `npm run rebuild_win` 此时已经安装成功!
|
||||||
|
|
||||||
|
## macos
|
||||||
|
macos 下安装就简单不少了,首先先解决翻墙的问题,然后:
|
||||||
|
```shell
|
||||||
|
$ npm i
|
||||||
|
```
|
||||||
|
|
||||||
|
最后执行
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$npm run rebuild
|
||||||
|
```
|
||||||
|
|
||||||
|
## 最后
|
||||||
|
如果您在启动过程中还有其他的问题,欢迎随时给我们反馈,我们会在第一时间回复:[issues](https://github.com/clouDr-f2e/rubick/issues/20)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
13819
docs/package-lock.json
generated
13819
docs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -93,9 +93,6 @@
|
|||||||
"vuex": "^3.0.1",
|
"vuex": "^3.0.1",
|
||||||
"vuex-electron": "^1.0.0"
|
"vuex-electron": "^1.0.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
|
||||||
"win-mouse": "git+https://github.com/Toinane/win-mouse"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ajv": "^6.5.0",
|
"ajv": "^6.5.0",
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
@ -139,5 +136,18 @@
|
|||||||
"webpack-dev-server": "^3.1.4",
|
"webpack-dev-server": "^3.1.4",
|
||||||
"webpack-hot-middleware": "^2.22.2",
|
"webpack-hot-middleware": "^2.22.2",
|
||||||
"webpack-merge": "^4.1.3"
|
"webpack-merge": "^4.1.3"
|
||||||
|
},
|
||||||
|
"iohook": {
|
||||||
|
"targets": [
|
||||||
|
"node-83",
|
||||||
|
"electron-85"
|
||||||
|
],
|
||||||
|
"platforms": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"arches": [
|
||||||
|
"x64",
|
||||||
|
"ia32"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user