You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

树莓派启动ODAS Studio遇Gtk显示错误求助

树莓派运行ODAS Studio启动失败问题

问题背景

在树莓派上使用ReSpeaker 4 Mic Array,按官方教程操作,运行npm start启动ODAS Studio时出现启动失败错误。

启动错误信息

google@raspberrypi:~/Desktop/odas_web $ npm start

> odas_studio@0.3.0 start /home/google/Desktop/odas_web
> electron .


(electron:35503): Gtk-WARNING **: 23:03:25.467: cannot open display:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! odas_studio@0.3.0 start: `electron .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the odas_studio@0.3.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/google/.npm/_logs/2023-07-29T15_03_25_554Z-debug.log

已尝试的修复操作

  • 清理依赖重装:
rm -rf node_modules 
rm package-lock.json yarn.lock 
npm cache clear --force
npm install
  • 执行npm update
  • 安装webpack:npm install webpack --save

完整错误日志

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.14.16
3 info using node@v12.22.12
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle odas_studio@0.3.0~prestart: odas_studio@0.3.0
6 info lifecycle odas_studio@0.3.0~start: odas_studio@0.3.0
7 verbose lifecycle odas_studio@0.3.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle odas_studio@0.3.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/google/Desktop/odas_web/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
9 verbose lifecycle odas_studio@0.3.0~start: CWD: /home/google/Desktop/odas_web
10 silly lifecycle odas_studio@0.3.0~start: Args: [ '-c', 'electron .' ]
11 silly lifecycle odas_studio@0.3.0~start: Returned: code: 1  signal: null
12 info lifecycle odas_studio@0.3.0~start: Failed to exec start script
13 verbose stack Error: odas_studio@0.3.0 start: `electron .`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1022:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid odas_studio@0.3.0
15 verbose cwd /home/google/Desktop/odas_web
16 verbose Linux 6.1.21-v8+

解决方案

核心错误是cannot open display,因Electron是GUI应用,无法找到可用显示输出,针对不同场景提供以下解决方法:

1. 本地桌面环境运行

如果使用树莓派自带屏幕或已连接远程桌面(VNC/XRDP),先进入Raspberry Pi Desktop桌面环境,打开终端后再执行npm start。

2. SSH远程连接时启用X11转发

通过SSH连接树莓派时,开启X11转发让GUI应用在本地显示:

  • 连接命令改为:ssh -X google@raspberrypi
  • 连接成功后执行echo $DISPLAY,确认输出类似:10.0,再运行npm start

3. 安装虚拟显示(无物理/远程桌面时)

安装虚拟显示服务模拟GUI环境:

sudo apt update && sudo apt install xvfb -y
xvfb-run -a npm start

4. 调整Node.js版本兼容性

当前Node.js v12.22.12和npm 6.x可能与项目依赖的Electron版本不兼容,尝试升级到Node.js 16.x版本:

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
# 重新安装依赖
rm -rf node_modules package-lock.json
npm install
npm start

内容的提问来源于stack exchange,提问作者70ygrandma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 01:25:11