AzurLaneAutoScript icon indicating copy to clipboard operation
AzurLaneAutoScript copied to clipboard

mac下yarn生成客户端不可用

Open baizi826 opened this issue 4 months ago • 10 comments

在提问之前...

  • [x] 我已经搜索了现有的 issues
  • [x] 我在提问题之前至少花费了 5 分钟来思考和准备
  • [x] 我已经阅读了 Wiki 中的 常见问题(FAQ)
  • [x] 我正在使用最新版的 Alas

描述你的问题

按照https://github.com/LmeSzinc/AzurLaneAutoScript/wiki/Installation_cn教程提到的方法生成出来的客户端无法打开

如何复现

  1. 下载node-v20.13.1.pkg手动安装
  2. Homebrew安装Yarn工具
  3. 打开yarn.lock替换registry.nlark.com为registry.npmmirror.com(查询了一下,前网址好像失效了)
  4. 打开终端,切换目录至webapp
  5. 运行yarn
  6. 运行yarn run compile

预期行为

No response

相关 Logs

Last login: Tue Sep  2 16:50:42 on ttys004
(base) mac@baizidemacdeMac-mini ~ % cd /Users/mac/AzurLaneAutoScript/webapp 
(base) mac@baizidemacdeMac-mini webapp % yarn
yarn install v1.22.22
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/6] 🔍  Validating package.json...
[2/6] 🔍  Resolving packages...
[3/6] 🚚  Fetching packages...
[4/6] 🔗  Linking dependencies...
warning " > @typescript-eslint/[email protected]" has unmet peer dependency "@typescript-eslint/parser@^4.0.0".
[5/6] 🔨  Building fresh packages...
[6/6] ♻️  Cleaning modules...
✨  Done in 15.96s.
(base) mac@baizidemacdeMac-mini webapp % yarn run compile
yarn run v1.22.22
$ cross-env MODE=production npm run build

> build
> node scripts/build.js

packages/main/
  vite v2.6.2 building for production...
  ✓ 373 modules transformed.
  dist/index.cjs   2.98 KiB
  dist/index.cjs.map 10.45 KiB
  dist/main.js     212.21 KiB
  dist/main.js.map 821.59 KiB
  Bundling time: 3.936s


packages/preload/
  vite v2.6.2 building for production...
  ✓ 1 modules transformed.
  dist/index.cjs   0.12 KiB
  dist/index.cjs.map 0.73 KiB
  Bundling time: 86.84ms


packages/renderer/
  vite v2.6.2 building for production...
  ✓ 1627 modules transformed.
  dist/index.html           0.46 KiB
  dist/index.ab8fac8b.js    2.56 KiB
  dist/index.ab8fac8b.js.map 7.51 KiB
  dist/vendor.bafb6147.js   95.46 KiB
  dist/vendor.bafb6147.js.map 771.38 KiB
  dist/index.49211cb1.css   0.51 KiB
  Bundling time: 2.275s


Total bundling time: 6.299s
$ electron-builder build --config electron-builder.config.js --dir
  • electron-builder  version=22.11.7 os=24.6.0
  • loaded configuration  file=/Users/mac/AzurLaneAutoScript/webapp/electron-builder.config.js
  • description is missed in the package.json  appPackageFile=/Users/mac/AzurLaneAutoScript/webapp/package.json
  • author is missed in the package.json  appPackageFile=/Users/mac/AzurLaneAutoScript/webapp/package.json
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=darwin arch=arm64 electron=15.1.0 appOutDir=dist/mac-arm64
  • skipped macOS application code signing  reason=cannot find valid "Developer ID Application" identity or custom non-Apple code signing certificate, see https://electron.build/code-signing allIdentities=     0 identities found
                                                Valid identities only
     0 valid identities found
✨  Done in 16.94s.
(base) mac@baizidemacdeMac-mini webapp % Last login: Tue Sep  2 16:50:42 on ttys004
(base) mac@baizidemacdeMac-mini ~ % cd /Users/mac/AzurLaneAutoScript/webapp 
(base) mac@baizidemacdeMac-mini webapp % yarn
yarn install v1.22.22
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/6] 🔍  Validating package.json...
[2/6] 🔍  Resolving packages...
[3/6] 🚚  Fetching packages...
[4/6] 🔗  Linking dependencies...
warning " > @typescript-eslint/[email protected]" has unmet peer dependency "@typescript-eslint/parser@^4.0.0".
[5/6] 🔨  Building fresh packages...
[6/6] ♻️  Cleaning modules...
✨  Done in 15.96s.
(base) mac@baizidemacdeMac-mini webapp % yarn run compile
yarn run v1.22.22
$ cross-env MODE=production npm run build

> build
> node scripts/build.js

packages/main/
  vite v2.6.2 building for production...
  ✓ 373 modules transformed.
  dist/index.cjs   2.98 KiB
  dist/index.cjs.map 10.45 KiB
  dist/main.js     212.21 KiB
  dist/main.js.map 821.59 KiB
  Bundling time: 3.936s


packages/preload/
  vite v2.6.2 building for production...
  ✓ 1 modules transformed.
  dist/index.cjs   0.12 KiB
  dist/index.cjs.map 0.73 KiB
  Bundling time: 86.84ms


packages/renderer/
  vite v2.6.2 building for production...
  ✓ 1627 modules transformed.
  dist/index.html           0.46 KiB
  dist/index.ab8fac8b.js    2.56 KiB
  dist/index.ab8fac8b.js.map 7.51 KiB
  dist/vendor.bafb6147.js   95.46 KiB
  dist/vendor.bafb6147.js.map 771.38 KiB
  dist/index.49211cb1.css   0.51 KiB
  Bundling time: 2.275s


Total bundling time: 6.299s
$ electron-builder build --config electron-builder.config.js --dir
  • electron-builder  version=22.11.7 os=24.6.0
  • loaded configuration  file=/Users/mac/AzurLaneAutoScript/webapp/electron-builder.config.js
  • description is missed in the package.json  appPackageFile=/Users/mac/AzurLaneAutoScript/webapp/package.json
  • author is missed in the package.json  appPackageFile=/Users/mac/AzurLaneAutoScript/webapp/package.json
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=darwin arch=arm64 electron=15.1.0 appOutDir=dist/mac-arm64
  • skipped macOS application code signing  reason=cannot find valid "Developer ID Application" identity or custom non-Apple code signing certificate, see https://electron.build/code-signing allIdentities=     0 identities found
                                                Valid identities only
     0 valid identities found
✨  Done in 16.94s.
(base) mac@baizidemacdeMac-mini webapp %

截图

Image Image

还有别的吗?

复现第三步参考https://juejin.cn/post/7368820207592325129

baizi826 avatar Sep 03 '25 13:09 baizi826

要不试试我包好的 https://github.com/swordfeng/alas-launcher

swordfeng avatar Sep 04 '25 04:09 swordfeng

运行路径需要是alas根目录

LmeSzinc avatar Sep 06 '25 13:09 LmeSzinc

运行路径需要是alas根目录

Image 根目录下运行是这样的

baizi826 avatar Sep 06 '25 13:09 baizi826

复制 config/deploy.template.yamlconfig/deploy.yaml

LmeSzinc avatar Sep 07 '25 14:09 LmeSzinc

Image复制过去还是这样,我用新的webapp又生成了一遍

复制 config/deploy.template.yamlconfig/deploy.yaml

baizi826 avatar Sep 07 '25 15:09 baizi826

对@baizi826 的操作进行了完全相同的复现,客户端仍不可用,已尝试上面提到的将编译出的.app文件移到项目根目录,用config/deploy.template.yaml覆盖config/deploy.yaml等解决方案,均未能解决问题

Image

NagatoBigSeven avatar Sep 12 '25 19:09 NagatoBigSeven

此外,在运行命令yarn之前,似乎需要先运行命令yarn config set "strict-ssl" false,否则似乎会报证书错误

若node版本过高,运行命令yarn run compile似乎会出现json导入的问题,需要:

将文件~/AzurLaneAutoScript/webapp/packages/main/vite.config.js的import {node} from '../../electron-vendors.config.json';这一行改为import {node} from '../../electron-vendors.config.json' assert {type: 'json'};

将文件(file)~/AzurLaneAutoScript/webapp/packages/preload/vite.config.js的import { chrome } from '../../electron-vendors.config.json';这一行改为import { chrome } from '../../electron-vendors.config.json' assert {type: 'json'};

将文件(file)~/AzurLaneAutoScript/webapp/packages/renderer/vite.config.js的import { chrome } from '../../electron-vendors.config.json';这一行改为import { chrome } from '../../electron-vendors.config.json' assert {type: 'json'};

才能够成功编译出网络应用程序

NagatoBigSeven avatar Sep 12 '25 19:09 NagatoBigSeven

此外,在运行命令yarn之前,似乎需要先运行命令yarn config set "strict-ssl" false,否则似乎会报证书错误

若node版本过高,运行命令yarn run compile似乎会出现json导入的问题,需要:

将文件~/AzurLaneAutoScript/webapp/packages/main/vite.config.js的import {node} from '../../electron-vendors.config.json';这一行改为import {node} from '../../electron-vendors.config.json' assert {type: 'json'};

将文件(file)~/AzurLaneAutoScript/webapp/packages/preload/vite.config.js的import { chrome } from '../../electron-vendors.config.json';这一行改为import { chrome } from '../../electron-vendors.config.json' assert {type: 'json'};

将文件(file)~/AzurLaneAutoScript/webapp/packages/renderer/vite.config.js的import { chrome } from '../../electron-vendors.config.json';这一行改为import { chrome } from '../../electron-vendors.config.json' assert {type: 'json'};

才能够成功编译出网络应用程序

Image

Image好像还是不行,node是否需要降级?该降级到什么版本?

baizi826 avatar Sep 13 '25 02:09 baizi826

此外,在运行命令yarn之前,似乎需要先运行命令yarn config set "strict-ssl" false,否则似乎会报证书错误 若node版本过高,运行命令yarn run compile似乎会出现json导入的问题,需要: 将文件~/AzurLaneAutoScript/webapp/packages/main/vite.config.js的import {node} from '../../electron-vendors.config.json';这一行改为import {node} from '../../electron-vendors.config.json' assert {type: 'json'}; 将文件(file)~/AzurLaneAutoScript/webapp/packages/preload/vite.config.js的import { chrome } from '../../electron-vendors.config.json';这一行改为import { chrome } from '../../electron-vendors.config.json' assert {type: 'json'}; 将文件(file)~/AzurLaneAutoScript/webapp/packages/renderer/vite.config.js的import { chrome } from '../../electron-vendors.config.json';这一行改为import { chrome } from '../../electron-vendors.config.json' assert {type: 'json'}; 才能够成功编译出网络应用程序

Image Image好像还是不行,node是否需要降级?该降级到什么版本?

这么搞确实不行,只是如实陈述在我的环境上复现你的问题出现的新问题

NagatoBigSeven avatar Sep 18 '25 19:09 NagatoBigSeven

@LmeSzinc 请求修复此问题

NagatoBigSeven avatar Sep 18 '25 19:09 NagatoBigSeven