Theia(全名Eclipse Theia)是一个可扩展的平台,用于使用最新的Web技术开发多语言的云端和桌面的 IDE
展示
耗费1天的时间终于在树莓派中把theia 搭了起来,期间出了各种错误,特此整理一下
环境
node 12.15.0
yarn 1.22.11
依赖
electron 9.1.0 (桌面端需要)
keytar
native-keymap
安装这几个包时简直了,,
# 首先down代码
git clone https://github.com/eclipse-theia/theia
# 完成后
cd ./theia
yarn all
yarn start browser # 默认启动在3000端口
# 也可以这样
yarn start browser --hostname 127.0.0.1 --port 3001
#完结撒花
遇到的问题
electron 安装报错
> electron@15.0.0 postinstall /www/server/nvm/versions/node/v12.15.0/lib/node_modules/electron
> node install.js
Error: EACCES: permission denied, mkdtemp '/www/server/nvm/versions/node/v12.15.0/lib/node_modules/electron/electron-download-NAObp0'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@15.0.0 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@15.0.0 postinstall 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! /root/.npm/_logs/2021-09-25T05_27_05_567Z-debug.log
root@ubuntu:/home/app/theia# npm install electron -g --unsafe-perm=true --allow-root
这个是因为权限不够导致的
npm install electron@9.1.0 --unsafe-perm=true
> core-js@3.18.0 postinstall /www/server/nvm/versions/node/v12.15.0/lib/node_modules/electron/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> electron@15.0.0 postinstall /www/server/nvm/versions/node/v12.15.0/lib/node_modules/electron
> node install.js
RequestError: socket hang up
at ClientRequest.<anonymous> (/www/server/nvm/versions/node/v12.15.0/lib/node_modules/electron/node_modules/got/source/request-as-event-emitter.js:178:14)
at Object.onceWrapper (events.js:313:26)
这个呢是因为下载electron 包的时候超时了 指定一下镜像源就可以了
npm install electron@9.1.0 --unsafe-perm=true --allow-root --electron-cdnurl=https://npmmirror.com/mirrors/electron
keytar 安装报错
Package libsecret-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsecret-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libsecret-1' found
gyp: Call to 'pkg-config --libs-only-l libsecret-1' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/www/server/nvm/versions/node/v12.15.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:223:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 5.4.0-1043-raspi
gyp ERR! command "/www/server/nvm/versions/node/v12.15.0/bin/node" "/www/server/nvm/versions/node/v12.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
其实缺少相关依赖
根据系统执行下一下命令即可
# Debian/Ubuntu:
sudo apt-get install libsecret-1-dev
# Red Hat-based:
sudo yum install libsecret-devel
# Arch Linux:
sudo pacman -S libsecret
native-keymap缺少依赖项
[4/4] Building fresh packages...
[8/10] ⠠ electron
[-/10] ⠠ waiting...
[6/10] ⠠ oniguruma
[9/10] ⠠ native-keymap
error /home/theia/theia-hello-world-extension/node_modules/native-keymap: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /home/theia/theia-hello-world-extension/node_modules/native-keymap
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@6.0.1
gyp info using node@10.18.0 | linux | x64
gyp info find Python using Python version 3.6.8 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [ '/home/theia/theia-hello-world-extension/node_modules/electron-rebuild/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
.
.
.
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
Package x11 was not found in the pkg-config search path.
Perhaps you should add the directory containing `x11.pc'
to the PKG_CONFIG_PATH environment variable
No package 'x11' found
Package xkbfile was not found in the pkg-config search path.
Perhaps you should add the directory containing `xkbfile.pc'
to the PKG_CONFIG_PATH environment variable
No package 'xkbfile' found
gyp: Call to 'pkg-config x11 xkbfile --cflags | sed s/-I//g' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/home/theia/theia-hello-world-extension/node_modules/electron-rebuild/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 3.10.0-693.el7.x86_64
gyp ERR! command "/home/theia/.nvm/versions/node/v10.18.0/bin/node" "/home/theia/theia-hello-world-extension/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/theia/theia-hello-world-extension/node_modules/native-keymap
native-keymap缺少依赖项
# On Debian/ubuntu :
sudo apt-get install libx11-dev libxkbfile-dev
# On Red Hat-based :
sudo yum install libx11-devel.x86_64 libxkbfile-devel.x86_64 # or .i686
# On FreeBSD:
sudo pkg install libX11
https://github.com/eclipse-theia/theia