Closed zxp19821005 closed 6 months ago
顺便补充一下,如果是要编译打包Arm64版本,需要将 "@lancedb/vectordb-linux-x64-gnu"
替换为 "@lancedb/vectordb-linux-arm64-gnu"
,这个我也不知道该如何在 package.json
中去写。
非常感谢您对该项目的关注!
首先关于LInux版本,由于我手边没有可以用的有图形界面的Linux机器,并且工作事务繁忙,所以确实无力去再维护一个Linux版本。但是我非常希望有朋友可以加入到贡献者行列,一起完善这个项目。
关于编译问题,可以先尝试一下 yarn dev
能否正常启动应用。
关于依赖问题我也不太清楚,应该是使用 yarn
自动安装后,你上述提到的缺失依赖和架构问题都会自动的被自动安装。(无需指明"@lancedb/vectordb-linux-x64-gnu" 或 "@lancedb/vectordb-linux-arm64-gnu", 都会在安装 vectordb 依赖时正确安装)
.npmrc 文件我已经改成了你建议的写法,非常感谢!
最后关于剥离Electron,这对于本机没有安装Electron和Chrome的朋友使用可能会造成困扰。后期在体积优化阶段,我希望是能够在不影响用户体验的情况,使用在线资源等方式下尽可能优化体积。你提到的方式我觉得可以建立一个另外的分支来让一些开发者或了解Electron的同学使用。
Error: ENOENT: no such file or directory, open '/home/zxp-endeavouros/.cache/paru/clone/gomoon-git/src/gomoon.git/resources/assistants.json'
不知道resources
中的文件在哪里可以下载?
另:
使用yarn
运行yarn run build
后一堆报错:
==> 正在开始 build()...
v18.19.1 is already installed.
Now using node v18.19.1 (npm v10.2.4)
Now using node v18.19.1 (npm v10.2.4)
Your network is OK.
yarn install v1.22.22
[1/4] Resolving packages...
success Already up-to-date.
$ electron-builder install-app-deps
• electron-builder version=24.6.4
• rebuilding native dependencies dependencies=sharp@0.32.6 platform=linux arch=x64
• install prebuilt binary name=sharp version=0.32.6 platform=linux arch=x64 napi=
Done in 0.74s.
yarn run v1.22.22
$ npm run typecheck && electron-vite build
> gomoon@1.0.7 typecheck
> npm run typecheck:node && npm run typecheck:web
> gomoon@1.0.7 typecheck:node
> tsc --noEmit -p tsconfig.node.json --composite false
src/lib/langchain.ts:161:30 - error TS6133: 'config' is declared but its value is never read.
161 export const newChatLlama = (config: { src: string; temperature: number }) => {
~~~~~~
src/main/lib/ai/tts.ts:36:25 - error TS6133: 'resolve' is declared but its value is never read.
36 return new Promise((resolve, reject) => {
~~~~~~~
src/main/lib/ai/tts.ts:41:24 - error TS2769: No overload matches this call.
Overload 1 of 2, '(timeoutId: string | number | Timeout | undefined): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'string | number | Timeout | undefined'.
Overload 2 of 2, '(id: number | undefined): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'number'.
41 clearTimeout(this.timer)
~~~~~~~~~~
src/main/lib/ai/tts.ts:44:19 - error TS6133: 'key' is declared but its value is never read.
44 for (let [key, value] of this.executorMap) {
~~~
src/main/lib/ai/tts.ts:45:17 - error TS2339: Property 'reject' does not exist on type 'Promise<any>'.
45 value.reject(`连接已关闭: ${reason} ${code}`)
~~~~~~
src/main/lib/ai/tts.ts:71:24 - error TS2339: Property 'resolve' does not exist on type 'Promise<any>'.
71 executor.resolve(result)
~~~~~~~
src/main/lib/ai/tts.ts:85:27 - error TS18047: 'matches' is possibly 'null'.
85 let requestId = matches.groups.id
~~~~~~~
src/main/lib/ai/tts.ts:85:27 - error TS18048: 'matches.groups' is possibly 'undefined'.
85 let requestId = matches.groups.id
~~~~~~~~~~~~~~
src/main/lib/ai/tts.ts:117:9 - error TS2345: Argument of type '{ resolve: (value: unknown) => void; reject: (reason?: any) => void; }' is not assignable to parameter of type 'Promise<any>'.
Object literal may only specify known properties, and 'resolve' does not exist in type 'Promise<any>'.
117 resolve,
~~~~~~~
src/main/lib/ai/tts.ts:165:20 - error TS2769: No overload matches this call.
Overload 1 of 2, '(timeoutId: string | number | Timeout | undefined): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'string | number | Timeout | undefined'.
Property '[Symbol.dispose]' is missing in type 'Timer' but required in type 'Timeout'.
Overload 2 of 2, '(id: number | undefined): void', gave the following error.
Argument of type 'Timer' is not assignable to parameter of type 'number'.
165 clearTimeout(this.timer)
~~~~~~~~~~
node_modules/@types/node/timers.d.ts:76:17
76 [Symbol.dispose](): void;
~~~~~~~~~~~~~~~~~~~~~~~~~
'[Symbol.dispose]' is declared here.
src/main/lib/ai/tts.ts:179:20 - error TS6133: 'resolve' is declared but its value is never read.
179 new Promise((resolve, reject) => {
~~~~~~~
Found 11 errors in 2 files.
Errors Files
1 src/lib/langchain.ts:161
10 src/main/lib/ai/tts.ts:36
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
顺便说明一下,剥离程序自带的Electron是ArchLinux相关打包准则中要求的,针对其他Linux发行版,并没有要求,比如Ubuntu、Debian、深度、Fedora等等。
不知道能不能单独上传到release里面呢?这样的话我在ArchLinux下打包可以直接下载,而使用123网盘的话无法直接下载,只有转存到我自己的git仓库里面。 https://github.com/zxp19821005/My_AUR_Files/releases
你尝试下载到本地,打包使用本地文件的方案呢?个人开发精力确实有限,我可以传到release上去,但不能保证后续的更新🥲
好吧 我已经上传到github了 : https://github.com/zxp19821005/My_AUR_Files/releases/tag/gomoon
yarn dev
报错:
$ yarn dev
yarn run v1.22.22
$ electron-vite dev
vite v4.5.0 building for development...
✓ 27 modules transformed.
out/main/lowdb-981658c5.js 2.32 kB
out/main/index.js 53.71 kB
✓ built in 318ms
build the electron main process successfully
-----
vite v4.5.0 building for development...
✓ 1 modules transformed.
out/preload/index.js 4.47 kB
✓ built in 14ms
build the electron preload files successfully
-----
dev server running for the electron renderer process at:
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
start electron app...
App threw an error during load
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/zxp-endeavouros/.cache/paru/clone/gomoon-git/src/gomoon.git/node_modules/node-fetch/src/index.js from /home/zxp-endeavouros/.cache/paru/clone/gomoon-git/src/gomoon.git/out/main/index.js not supported.
Instead change the require of /home/zxp-endeavouros/.cache/paru/clone/gomoon-git/src/gomoon.git/node_modules/node-fetch/src/index.js in /home/zxp-endeavouros/.cache/paru/clone/gomoon-git/src/gomoon.git/out/main/index.js to a dynamic import() which is available in all CommonJS modules.
at l._load (node:electron/js2c/asar_bundle:2:13642)
at Object.<anonymous> (/home/zxp-endeavouros/.cache/paru/clone/gomoon-git/src/gomoon.git/out/main/index.js:47:15)
at l._load (node:electron/js2c/asar_bundle:2:13642)
A JavaScript error occurred in the main process
Uncaught Exception:
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/zxp-endeavouros/.cache/paru/clone/gomoon-git/src/gomoon.git/node_modules/node-fetch/src/index.js from /home/zxp-endeavouros/.cache/paru/clone/gomoon-git/src/gomoon.git/out/main/index.js not supported.
Instead change the require of /home/zxp-endeavouros/.cache/paru/clone/gomoon-git/src/gomoon.git/node_modules/node-fetch/src/index.js in /home/zxp-endeavouros/.cache/paru/clone/gomoon-git/src/gomoon.git/out/main/index.js to a dynamic import() which is available in all CommonJS modules.
at l._load (node:electron/js2c/asar_bundle:2:13642)
at Object.<anonymous> (/home/zxp-endeavouros/.cache/paru/clone/gomoon-git/src/gomoon.git/out/main/index.js:47:15)
at l._load (node:electron/js2c/asar_bundle:2:13642)
将 node-fetch 降低版本到:"node-fetch": "^2.6.4", 试试呢?
另外上述的问题很大程度上都是因为开发过程中没有对导入依赖进行lint检查,导致出现了很多幽灵依赖。这是我的问题,后续会加入检查来强要求的!
将 node-fetch 降低版本到:"node-fetch": "^2.6.4", 试试呢?
报同样的错误。
上述报错是因为最新的 node-fetch 版本已经是一个 ES 模块。此时使用编译后的代码(require('node-fetch')形式仍然了使用CommonJS)就会报错。 应该是可以通过降低 node-fetch 版本来解决模块问题的(降至可以使用CommonJS模块加载的版本)
哈喽,请问问题解决了吗?如果可以我就关闭该issue了😇
目前已经可以运行了,谢谢!
首先非常感谢开发了这个软件包! 从微信公众号上看到了这个项目,然后我搜索了一下ArchLinux的AUR,发现没有人移植,同时在官网也没有找到Linux版本的下载地址,于是我就准备自己编译一下,结果遇到了一堆问题,现将问题反馈如下: 1、
src/main/index.ts
中import icon from '../../resources/icon.png?asset'
和src/min/windows.ts
中import trayIcon from '../../resources/icon@20.png?asset'
都指向了不存在的resources
目录,这个我通过如下命令解决了:2、
.npmrc
建议修改为以下内容,这样在国内可以正常编译:3、Linux下缺少很多node_modules,建议添加:
都是我编译完成后运行软件,在终端报错缺少XXX模块,然后我逐一添加的。 4、建议将
package.json
中"electron": "28.0.0",
改为"electron": "^28.0.0",
,以使用最新版的Electron28,大版本中的小版本应该是可以向下兼容的,至少我目前移植的所有使用Electron开发的包都是这样的。 5、最终编译成功,但是运行时依然报错:我本人不是程序员,也不知道该如何解决~ 附上AUR代码(剥离了编译后的Electron28,直接使用系统自带的,减小软件体积): PKGBUILD
gomoon.sh