CyanSalt/commas

Cann't run in ArchLinux(Maybe all Linux distribution)

Opened this issue · 18 comments

I've porting this packages to ArchLinux.
OS:ArchLinux
Kernel:6.1.28-1-lts
DE:Cinnamon 5.6.2.

the PKGBUILD file as below:

# Maintainer: zxp19821005 <zxp19821005 at 163 dot com>
pkgname="commas-bin"
pkgver=0.25.1
pkgrel=1
pkgdesc="A hackable, pluggable terminal, and also a command runner."
arch=("x86_64")
url="https://github.com/CyanSalt/commas"
license=('ISC')
depends=('libdrm' 'expat' 'alsa-lib' 'glibc' 'cairo' 'nss' 'libxext' 'pango' 'gtk3' 'libxkbcommon' 'glib2' 'libcups' 'gcc-libs' \
    'libxfixes' 'java-runtime' 'at-spi2-core' 'libxcomposite' 'libxrandr' 'nspr' 'libxdamage' 'dbus' 'sh' 'libxcb' 'mesa' 'libx11')
makedepends=('gendesk')
conflicts=("${pkgname%-bin}")
options=(!strip)
source=("${pkgname%-bin}-${pkgver}.zip::${url}/releases/download/v${pkgver}/Commas-linux-x64.zip"
    "${pkgname%-bin}.png::https://raw.githubusercontent.com/CyanSalt/commas/master/resources/images/icon.png")
sha256sums=('ccf0080f24b460f26526702abe58b0b66ffdea7a67d0e0464d1a8d7e353b01e9'
            '65b65c25d8d68549dc271f7c755426ba8884f6ae9fb3a8061eec65c241345f48')
package() {
    install -Dm755 -d "${pkgdir}/opt/${pkgname%-bin}"
    cp -r "${srcdir}/Commas-linux-x64/"* "${pkgdir}/opt/${pkgname%-bin}"
    install -Dm644 "${srcdir}/Commas-linux-x64/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
    install -Dm644 "${srcdir}/${pkgname%-bin}.png" -t "${pkgdir}/usr/share/pixmaps"
    gendesk -f -n --icon "${pkgname%-bin}" --categories "Utility" --name "Commas" --exec "/opt/${pkgname%-bin}/Commas --no-sandbox %U"
    install -Dm644 "${srcdir}/${pkgname%-bin}.desktop" -t "${pkgdir}/usr/share/applications"
}

When I run the program in terminal,I got an error message like this:

$ /opt/commas/Commas
innerError Error: Cannot find module '../build/Debug/pty.node'
Require stack:
- /opt/commas/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js
- /opt/commas/resources/app.asar/node_modules/node-pty/lib/index.js
- /opt/commas/resources/app.asar/dist/main/index.js
- 
    at Module._resolveFilename (node:internal/modules/cjs/loader:1002:15)
    at n._resolveFilename (node:electron/js2c/browser_init:2:109457)
    at Module._load (node:internal/modules/cjs/loader:848:27)
    at f._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1068:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/opt/commas/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js:30:15)
    at Module._compile (node:internal/modules/cjs/loader:1174:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1229:10)
    at Module.load (node:internal/modules/cjs/loader:1044:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/opt/commas/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js',
    '/opt/commas/resources/app.asar/node_modules/node-pty/lib/index.js',
    '/opt/commas/resources/app.asar/dist/main/index.js',
    undefined
  ]
}
A JavaScript error occurred in the main process
Uncaught Exception:
Error: /opt/commas/resources/app.asar.unpacked/node_modules/node-pty/build/Release/pty.node: æ æç
                                                                                                  ELF 头
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:1822)
    at Module._extensions..node (node:internal/modules/cjs/loader:1259:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:2:2049)
    at Module.load (node:internal/modules/cjs/loader:1044:32)
    at Module._load (node:internal/modules/cjs/loader:885:12)
    at f._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1068:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/opt/commas/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js:26:11)
    at Module._compile (node:internal/modules/cjs/loader:1174:14)

npm install

$ npm install
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated

> commas@0.26.0 postinstall
> node post-install.js


added 1137 packages, and audited 1139 packages in 13s

246 packages are looking for funding
  run `npm fund` for details

10 vulnerabilities (3 moderate, 1 high, 6 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

npm run build

$ npm run build

> commas@0.26.0 build
> node build/build.mjs && node build/pack.mjs -- --local

vite v4.3.7 building for production...
vite v4.3.7 building for production... (x2)
vite v4.3.7 building for production... (x3)
vite v4.3.7 building for production... (x4)
vite v4.3.7 building for production... (x5)
vite v4.3.7 building for production... (x6)
vite v4.3.7 building for production... (x7)
vite v4.3.7 building for production... (x8)
vite v4.3.7 building for production... (x9)
vite v4.3.7 building for production... (x10)
vite v4.3.7 building for production... (x11)
vite v4.3.7 building for production... (x12)
vite v4.3.7 building for production... (x13)
vite v4.3.7 building for production... (x14)
vite v4.3.7 building for production... (x15)
vite v4.3.7 building for production... (x16)
✓ 2 modules transformed.
✓ 3 modules transformed.
✓ 3 modules transformed. (x2)
✓ 3 modules transformed. (x3)
✓ 5 modules transformed.
✓ 5 modules transformed. (x2)
✓ 5 modules transformed. (x3)
dist/renderer/index.js  4.02 kB │ gzip: 1.38 kB
✓ built in 1.03s
✓ 13 modules transformed.
✓ 10 modules transformed.
✓ 8 modules transformed.
✓ 11 modules transformed.
✓ 8 modules transformed.
dist/renderer/index.js  3.30 kB │ gzip: 1.20 kB
✓ built in 1.13s
✓ 3 modules transformed.
✓ built in 1.27s
Could not resolve "./components/App.vue" from "src/renderer/app.ts"
file: /home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/src/renderer/app.ts
file:///home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/node_modules/rollup/dist/es/shared/node-entry.js:2125
        base = Object.assign(new Error(base.message), base);
                             ^

Error [RollupError]: Could not resolve "./components/App.vue" from "src/renderer/app.ts"
    at error (file:///home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/node_modules/rollup/dist/es/shared/node-entry.js:2125:30)
    at ModuleLoader.handleInvalidResolvedId (file:///home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/node_modules/rollup/dist/es/shared/node-entry.js:23979:24)
    at file:///home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/node_modules/rollup/dist/es/shared/node-entry.js:23941:26 {
  code: 'UNRESOLVED_IMPORT',
  exporter: './components/App.vue',
  id: '/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/src/renderer/app.ts',
  watchFiles: [
    '/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/src/renderer/index.html',
    '\x00vite/modulepreload-polyfill',
    '/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/src/renderer/app.ts'
  ]
}

Node.js v18.17.0

Also saw this using a prebuilt binary on Linux Mint.

我将commas-0.26.0/src/renderer/app.ts中的'./components/App.vue'替换为'./components/app.vue'
报错信息没有了,可以编译成功。
我分别使用node v14.21.3 (npm v6.14.18)node v16.20.1 (npm v8.19.4)node v18.17.0 (npm v9.6.7)打包,但最后都报另外一个错误:

$ ./release/Commas-linux-x64/Commas 
TypeError: import_electron11.systemPreferences.getAccentColor is not a function
    at ReactiveEffect.fn (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/dist/main/index.js:1617:59)
    at ReactiveEffect.run (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/node_modules/@vue/reactivity/dist/reactivity.cjs.js:182:19)
    at get value [as value] (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/node_modules/@vue/reactivity/dist/reactivity.cjs.js:1143:33)
    at ReactiveEffect.fn (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/dist/main/index.js:1663:55)
    at ReactiveEffect.run (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/node_modules/@vue/reactivity/dist/reactivity.cjs.js:182:19)
    at effect (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/node_modules/@vue/reactivity/dist/reactivity.cjs.js:228:13)
    at handleThemeMessages (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/dist/main/index.js:1662:33)
    at Object.<anonymous> (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/dist/main/index.js:2750:1)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1296:10)

这下我是真的不知道该怎么搞了。

AUR的链接如下: https://aur.archlinux.org/packages/commas-bin
请问现在有活跃的开发者来解决这个问题么?

npm install

$ npm install
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated

> commas@0.26.0 postinstall
> node post-install.js


added 1137 packages, and audited 1139 packages in 13s

246 packages are looking for funding
  run `npm fund` for details

10 vulnerabilities (3 moderate, 1 high, 6 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

npm run build

$ npm run build

> commas@0.26.0 build
> node build/build.mjs && node build/pack.mjs -- --local

vite v4.3.7 building for production...
vite v4.3.7 building for production... (x2)
vite v4.3.7 building for production... (x3)
vite v4.3.7 building for production... (x4)
vite v4.3.7 building for production... (x5)
vite v4.3.7 building for production... (x6)
vite v4.3.7 building for production... (x7)
vite v4.3.7 building for production... (x8)
vite v4.3.7 building for production... (x9)
vite v4.3.7 building for production... (x10)
vite v4.3.7 building for production... (x11)
vite v4.3.7 building for production... (x12)
vite v4.3.7 building for production... (x13)
vite v4.3.7 building for production... (x14)
vite v4.3.7 building for production... (x15)
vite v4.3.7 building for production... (x16)
✓ 2 modules transformed.
✓ 3 modules transformed.
✓ 3 modules transformed. (x2)
✓ 3 modules transformed. (x3)
✓ 5 modules transformed.
✓ 5 modules transformed. (x2)
✓ 5 modules transformed. (x3)
dist/renderer/index.js  4.02 kB │ gzip: 1.38 kB
✓ built in 1.03s
✓ 13 modules transformed.
✓ 10 modules transformed.
✓ 8 modules transformed.
✓ 11 modules transformed.
✓ 8 modules transformed.
dist/renderer/index.js  3.30 kB │ gzip: 1.20 kB
✓ built in 1.13s
✓ 3 modules transformed.
✓ built in 1.27s
Could not resolve "./components/App.vue" from "src/renderer/app.ts"
file: /home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/src/renderer/app.ts
file:///home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/node_modules/rollup/dist/es/shared/node-entry.js:2125
        base = Object.assign(new Error(base.message), base);
                             ^

Error [RollupError]: Could not resolve "./components/App.vue" from "src/renderer/app.ts"
    at error (file:///home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/node_modules/rollup/dist/es/shared/node-entry.js:2125:30)
    at ModuleLoader.handleInvalidResolvedId (file:///home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/node_modules/rollup/dist/es/shared/node-entry.js:23979:24)
    at file:///home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/node_modules/rollup/dist/es/shared/node-entry.js:23941:26 {
  code: 'UNRESOLVED_IMPORT',
  exporter: './components/App.vue',
  id: '/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/src/renderer/app.ts',
  watchFiles: [
    '/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/src/renderer/index.html',
    '\x00vite/modulepreload-polyfill',
    '/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/src/renderer/app.ts'
  ]
}

Node.js v18.17.0

I just fixed the issue mentioned here. I will try my best working on compatibility on Linux, but I may not be able to completely fix it since I don't have a Linux desktop environment.

我将commas-0.26.0/src/renderer/app.ts中的'./components/App.vue'替换为'./components/app.vue' 报错信息没有了,可以编译成功。 我分别使用node v14.21.3 (npm v6.14.18)node v16.20.1 (npm v8.19.4)node v18.17.0 (npm v9.6.7)打包,但最后都报另外一个错误:

$ ./release/Commas-linux-x64/Commas 
TypeError: import_electron11.systemPreferences.getAccentColor is not a function
    at ReactiveEffect.fn (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/dist/main/index.js:1617:59)
    at ReactiveEffect.run (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/node_modules/@vue/reactivity/dist/reactivity.cjs.js:182:19)
    at get value [as value] (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/node_modules/@vue/reactivity/dist/reactivity.cjs.js:1143:33)
    at ReactiveEffect.fn (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/dist/main/index.js:1663:55)
    at ReactiveEffect.run (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/node_modules/@vue/reactivity/dist/reactivity.cjs.js:182:19)
    at effect (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/node_modules/@vue/reactivity/dist/reactivity.cjs.js:228:13)
    at handleThemeMessages (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/dist/main/index.js:1662:33)
    at Object.<anonymous> (/home/zxp-endeavouros/.cache/paru/clone/tmp/commas-0.26.0/release/Commas-linux-x64/resources/app.asar/dist/main/index.js:2750:1)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1296:10)

这下我是真的不知道该怎么搞了。

@zxp19821005

This has also been fixed. I just released version 0.28.0. Can you try it and see if the problem still exists? Of course also welcome to try building from source and log issues.

这里也已经修复。我刚刚发布了 0.28.0 版本。你能否尝试一下是否依然存在问题?当然也欢迎尝试从源码构建并记录问题。

The 0.28.0 binary still isn't working for me (this time on Fedora) log below.

I did manage to build from source just fine and the binary it produces works.

[dae@yoga-fedora Commas-linux-x64]$ ./Commas 
innerError Error: Cannot find module '../build/Debug/pty.node'
Require stack:
- /home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js
- /home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/index.js
- /home/dae/apps/Commas-linux-x64/resources/app.asar/dist/main/index.js
- 
    at node:internal/modules/cjs/loader:1084:15
    at Function._resolveFilename (node:electron/js2c/browser_init:2:117419)
    at node:internal/modules/cjs/loader:929:27
    at Function._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js:34:15)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js',
    '/home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/index.js',
    '/home/dae/apps/Commas-linux-x64/resources/app.asar/dist/main/index.js',
    undefined
  ]
}
A JavaScript error occurred in the main process
Uncaught Exception:
Error: /home/dae/apps/Commas-linux-x64/resources/app.asar.unpacked/node_modules/node-pty/build/Release/pty.node: invalid ELF header
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:1822)
    at Object.<anonymous> (node:internal/modules/cjs/loader:1356:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:2:2049)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at Function._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js:29:11)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)

It appears that the *.node native module generated by macOS does not work in Linux, even though it is generated for the Electron runtime. I'll look into this.

我在ArchLinux的AUR上又创建了另外一个包: https://aur.archlinux.org/packages/commas (需要自己手动编译的)
这次是编译成功,也能够运行。但是运行之后,点击任意按钮或者什么都不点,不到5秒钟界面就卡死了,然后变成透明界面了,就只剩下一个标题栏。通过终端运行,日志显示如下:

$ commas
[134691:0914/114502.229030:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.InvalidArgs: 无此接口“org.freedesktop.portal.FileChooser”
[134691:0914/114502.229070:ERROR:select_file_dialog_linux_portal.cc(274)] Failed to read portal version property
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94495)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/opt/commas/resources/app.asar/dist/main/index.js:1481:23)
    at BrowserWindow.emit (node:events:525:35)

我在ArchLinux的AUR上又创建了另外一个包: https://aur.archlinux.org/packages/commas (需要自己手动编译的) 这次是编译成功,也能够运行。但是运行之后,点击任意按钮或者什么都不点,不到5秒钟界面就卡死了,然后变成透明界面了,就只剩下一个标题栏。通过终端运行,日志显示如下:

$ commas
[134691:0914/114502.229030:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.InvalidArgs: 无此接口“org.freedesktop.portal.FileChooser”
[134691:0914/114502.229070:ERROR:select_file_dialog_linux_portal.cc(274)] Failed to read portal version property
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94495)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/opt/commas/resources/app.asar/dist/main/index.js:1481:23)
    at BrowserWindow.emit (node:events:525:35)

虽然不确定,我认为这可能与 https://wiki.archlinux.org/title/XDG_Desktop_Portal 有关。是否意味着需要依赖 xdg-desktop-portal 或者 xdg-desktop-portal-gtk

The 0.28.0 binary still isn't working for me (this time on Fedora) log below.

I did manage to build from source just fine and the binary it produces works.

[dae@yoga-fedora Commas-linux-x64]$ ./Commas 
innerError Error: Cannot find module '../build/Debug/pty.node'
Require stack:
- /home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js
- /home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/index.js
- /home/dae/apps/Commas-linux-x64/resources/app.asar/dist/main/index.js
- 
    at node:internal/modules/cjs/loader:1084:15
    at Function._resolveFilename (node:electron/js2c/browser_init:2:117419)
    at node:internal/modules/cjs/loader:929:27
    at Function._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js:34:15)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js',
    '/home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/index.js',
    '/home/dae/apps/Commas-linux-x64/resources/app.asar/dist/main/index.js',
    undefined
  ]
}
A JavaScript error occurred in the main process
Uncaught Exception:
Error: /home/dae/apps/Commas-linux-x64/resources/app.asar.unpacked/node_modules/node-pty/build/Release/pty.node: invalid ELF header
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:1822)
    at Object.<anonymous> (node:internal/modules/cjs/loader:1356:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:2:2049)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at Function._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/home/dae/apps/Commas-linux-x64/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js:29:11)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)

Can you try the version https://github.com/CyanSalt/commas/releases/tag/v0.28.1-alpha.0 ? I just tried rebuilding the native module using @electron/rebuild.

最新版的试过了https://github.com/CyanSalt/commas/releases/tag/v0.28.1-alpha.0 我清除了配置缓存 ~/.config/commas后运行,还是一样的结果

v0.28.1-alpha.0 is still broken in the same way for me too. Are these binaries not being produced on a Linux machine? You should be able to set up a GitHub action to get valid Linux binaries if not.

最新提交的版本,已经基本可用了。我已经移植到了AUR: https://aur.archlinux.org/packages/commas-git
目前存在问题:

编译问题

刚开始编译安装运行时提示缺少ansi-styles,添加之后又提示缺少supports-color,编译时添加这两个npm包之后运行就没有其他报错信息了。

界面问题

整体界面默认是透明的。透明度调整的有点大,基本上看不太清楚。图标什么的基本上看不到,菜单栏也没有的。
后面无意中点击界面左下方,才点开设置界面。
2023-11-02_17-05
而且运行后还提示一条错误信息:

bash: /usr/lib/commas/app.asar/bin/.shell-integration/bash.sh: 不是目录

不知道这个是怎么出现的。
还有刚才无意中点击了标题栏上方的类似于打开文件的按钮,结果终端报错了:

$ commas
[394018:1102/170039.385531:ERROR:object_proxy.cc(577)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.InvalidArgs: 无此接口“org.freedesktop.portal.FileChooser”
[394018:1102/170039.385558:ERROR:select_file_dialog_linux_portal.cc(280)] Failed to read portal version property
Warning: vkCreateInstance: Found no drivers!
Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:88)
    at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:458)
    at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:344)
    at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:266)
    at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:521)

也没有弹出文件打开窗口之类的

配置文件

修改配置文件后点击报错,终端报错:

[Error: ENOTDIR: not a directory, open '/usr/lib/commas/app.asar/userdata/settings.yaml'] {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'open',
  path: '/usr/lib/commas/app.asar/userdata/settings.yaml'
}

感觉这个似乎应该是Windows下的目录配置吧?或者我应该将app.asar解包?

编译问题

刚开始编译安装运行时提示缺少ansi-styles,添加之后又提示缺少supports-color,编译时添加这两个npm包之后运行就没有其他报错信息了。

大概率是因为 chalk 是 cli 插件的依赖而非 terminal 核心依赖,所以深层依赖没有被正确处理。默认的 for macOS 的构建中我做了一些魔法操作让它能够正确被 electron-packager 识别,不确定在 Arch 的构建中是否也可以使用类似的方式。

界面问题

整体界面默认是透明的。透明度调整的有点大,基本上看不太清楚。图标什么的基本上看不到,菜单栏也没有的。 后面无意中点击界面左下方,才点开设置界面。

vibrancy 的问题我可能需要单独排查一下,应该在 Windows 下也会有类似的问题。

2023-11-02_17-05 而且运行后还提示一条错误信息:

bash: /usr/lib/commas/app.asar/bin/.shell-integration/bash.sh: 不是目录

这是 terminal.shell.integration 设置项导致的,bash.sh 被作为 Bash 的 --init-file 注入。但是正常 bin 是不应该被打包进 ASAR 的,在 electron-packager 中它是 extraResource 所以应该会在 resources 目录下

不知道这个是怎么出现的。 还有刚才无意中点击了标题栏上方的类似于打开文件的按钮,结果终端报错了:

$ commas
[394018:1102/170039.385531:ERROR:object_proxy.cc(577)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.InvalidArgs: 无此接口“org.freedesktop.portal.FileChooser”
[394018:1102/170039.385558:ERROR:select_file_dialog_linux_portal.cc(280)] Failed to read portal version property
Warning: vkCreateInstance: Found no drivers!
Warning: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    at CheckVkSuccessImpl (../../third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:88)
    at CreateVkInstance (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:458)
    at Initialize (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:344)
    at Create (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:266)
    at operator() (../../third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:521)

也没有弹出文件打开窗口之类的

应该是 Linux 下的 Electron 构建依赖导致的,具体原因我无法确定

配置文件

修改配置文件后点击报错,终端报错:

[Error: ENOTDIR: not a directory, open '/usr/lib/commas/app.asar/userdata/settings.yaml'] {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'open',
  path: '/usr/lib/commas/app.asar/userdata/settings.yaml'
}

感觉这个似乎应该是Windows下的目录配置吧?或者我应该将app.asar解包?

看上去 Electron 没有正确识别当前是已打包状态,app/userdata 是非打包状态下(app.isPackagedfalse)时的配置目录。

最新的0.3.0,大部分问题都解决了,目前只有2个问题依旧:
1是需要添加ansi-styles npm add ansi-styles
2是依然无法识别app.asar打包状态

[Error: ENOTDIR: not a directory, open '/usr/lib/commas/app.asar/userdata/settings.yaml'] {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'open',
  path: '/usr/lib/commas/app.asar/userdata/settings.yaml'}

刚才又新发现了一个问题,双击标题栏最大化之后,确实是全屏了,但是有效输入和显示区域没有变化,只是从屏幕正中心移动到了靠左上角的部分。
image

最新的0.3.0,大部分问题都解决了,目前只有2个问题依旧: 1是需要添加ansi-styles npm add ansi-styles 2是依然无法识别app.asar打包状态

问题 1 似乎不太正常。使用 DEBUG=1 npm run build 本地构建后可以发现 linux release 下的 resources/app/node_modules 下是有 ansi-styles 的。

问题 2 我怀疑和 process.execPath 在 linux 下的工作方式有关。我目前没有设备测试,或许可以尝试将 src/main/utils/directory.ts#L6app.isPackaged 更改为 !process.defaultApp 试下(将判断方式从文件改为参数)

[Error: ENOTDIR: not a directory, open '/usr/lib/commas/app.asar/userdata/settings.yaml'] {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'open',
  path: '/usr/lib/commas/app.asar/userdata/settings.yaml'}

刚才又新发现了一个问题,双击标题栏最大化之后,确实是全屏了,但是有效输入和显示区域没有变化,只是从屏幕正中心移动到了靠左上角的部分。 image

首先出现两个标题栏是不正常的,最新的 commit 包含了修复;区域的问题,如果手动调整窗口尺寸会响应吗?看上去似乎是全屏操作没有触发 DOM 事件

第一个问题,编译的时候确实是有ansi-styles这个目录存在

$ tree node_modules/ansi-styles 
node_modules/ansi-styles
├── index.d.ts
├── index.js
├── license
├── package.json
└── readme.md

1 directory, 5 files

但是运行的时候报错:

$ /usr/bin/commas
Error: Cannot find module 'ansi-styles'
Require stack:
- /usr/lib/commas/app.asar/addons/cli/node_modules/chalk/source/index.js
- /usr/lib/commas/app.asar/addons/cli/dist/main/index.js
- /usr/lib/commas/app.asar/addons/cli/index.js
- /usr/lib/commas/app.asar/dist/main/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1084:15)
    at s._resolveFilename (node:electron/js2c/browser_init:2:114214)
    at Function.resolveFilename [as _resolveFilename] (/usr/lib/commas/app.asar/dist/main/index.js:2282:40)
    at Module._load (node:internal/modules/cjs/loader:929:27)
    at c._load (node:electron/js2c/node_init:2:13672)
    at Module.require (node:internal/modules/cjs/loader:1150:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/usr/lib/commas/app.asar/addons/cli/node_modules/chalk/source/index.js:2:20)
    at Module._compile (node:internal/modules/cjs/loader:1271:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1326:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/lib/commas/app.asar/addons/cli/node_modules/chalk/source/index.js',
    '/usr/lib/commas/app.asar/addons/cli/dist/main/index.js',
    '/usr/lib/commas/app.asar/addons/cli/index.js',
    '/usr/lib/commas/app.asar/dist/main/index.js'
  ]
}

但是程序可以正常运行。
第二个问题,我按照你的建议修改了代码:

sed "s|app.isPackaged|!process.defaultApp|g" -i src/main/utils/directory.ts

现在双击已经全屏了,依然存在2个标题栏,但是全屏可用了。