本博客主要记录在windows 11对theia example IDE配置的过程以及遭遇的问题和相应解决办法。
配置说明
参考theia github repo theia/doc/Developing.md at master · eclipse-theia/theia (github.com)
按照如上说明操作即可:
1. install scoop
参考Scoop (有博主提到未使用也可以 Theia开发环境搭建_theia python-CSDN博客)
执行:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
注意最好不要像scoop github上安装aira2,后续有可能会出错
2. 关于windows-build-tools: 应该不用安装。如果要自己手动安装会有问题:比如我遇到安装2022版本时,卡死在visua studio build tools安装。(npm install windows-build-tools 出现 Stuck at Still waiting for installer log file…-CSDN博客)换成2017版本即可正常。
进入Quick start部分
说明:所有操作均在PowerShell中以管理员模式执行。
过程中先后遇到如下错误
1. Exit code: 1 Command: node-gyp rebuild … MSBUILD : error MSB1009: Project file does not exist. Switch: build/binding.sln gyp ERR! build error
原因在于我将git clone到了Windows/system32文件夹中。而windows会禁止外界程序在该路径下的操作权限。
2. gyp err find python python is not set from command line r npm configuration: firebase - npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration - Stack Overflow
npm config set python your/path/of/python.exe
3. 在执行node install.js时,download electron过程中报错: 参考记录window安装electron失败的解决方案。_electronic window下打包后 安装失败-CSDN博客
打开node_modules\electron\install.js修改代码
downloadArtifact({
version,
artifactName: 'electron',
force: process.env.force_no_cache === 'true',
cacheRoot: process.env.electron_config_cache,
platform: process.env.npm_config_platform || process.platform,
arch: process.env.npm_config_arch || process.arch,
//添加代码,
mirrorOptions:{
mirror: 'https://npm.taobao.org/mirrors/electron/',
customDir: version
}
}).then(extractFile).catch(err => {
console.error(err.stack)
process.exit(1)
})
4. yarn electron build 过程中报错:Could not find any Visual Studio installation to use
状态类似如下:
我在用户、系统变量均手动设定了:GYP_MSVS_VERSION的值为2022(对应自己的visual studio installer版本,可以搜索后打开查看。)
设定后如下所示:
之后关闭命令行(让系统更新,实在不行重启。),重新执行yarn electron build
,即可成功。
*5. node:internal/process/promises:289 trigger UncaughtException(err,true * fromPromise /) … ENCONNRESET
具体状态如下图:
一般和enconnreset相关的错误都是网络问题。此处通过科学上网解决。
说明:yarn的过程非常漫长(大约二十五分钟左右),需要耐心等待。
最后,执行yarn electron start
即可成功,状态如下图所示。对于browser模式,先后执行yarn browser build
和yarn browser start
后也可成功。