Windows 11 theia example环境配置报错与解决汇总

本博客主要记录在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中以管理员模式执行。
![[Pasted image 20240921211110.png]]

过程中先后遇到如下错误
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会禁止外界程序在该路径下的操作权限。
![[Pasted image 20240921212028.png]]

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
状态类似如下:![[Pasted image 20240921213959.png]]

参考:What Should I Do If the Error Message “Could not find any Visual Studio installation to use” Is Displayed When I Compile a .node File on Windows?_Meeting_Huawei Cloud

我在用户、系统变量均手动设定了:GYP_MSVS_VERSION的值为2022(对应自己的visual studio installer版本,可以搜索后打开查看。)
在这里插入图片描述
设定后如下所示:
![[Pasted image 20240921214104.png]]

之后关闭命令行(让系统更新,实在不行重启。),重新执行yarn electron build,即可成功。

*5. node:internal/process/promises:289 trigger UncaughtException(err,true * fromPromise /) … ENCONNRESET
具体状态如下图:
在这里插入图片描述

一般和enconnreset相关的错误都是网络问题。此处通过科学上网解决。

说明:yarn的过程非常漫长(大约二十五分钟左右),需要耐心等待。

最后,执行yarn electron start即可成功,状态如下图所示。对于browser模式,先后执行yarn browser buildyarn browser start后也可成功。在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值