wix314等问题

解决思路
类似如下这种错误,可以直接根据提示的链接下载对应的包

GDScript3
5 行
warning: `app` (bin "app") generated 1 warning
    Finished `release` profile [optimized] target(s) in 4.52s
        Info Verifying wix package
 Downloading https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip
       Error failed to bundle project: `https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip: Network Error: Network Error: Error encountered in the status line: unexpected end of file`

然后解压在

代码片段
1 行
C:\Users\${User}\AppData\Local\tarui\WixTools314

这个目录下,然后就可以继续执行npm run tauri build编译,最终文件目录如下

代码片段
6 行
--WixTools314
	--doc
	--sdk
	--x86
	--candle.exe
	--...

如果还会产生wix之类的问题,那么就可能是tarui\WixTools314这个目录不对,具体查看github中的源码
https://github.com/tauri-apps/tauri/blob/dev/tooling/bundler/src/bundle/windows/msi.rs

nsis问题

类似如下这种错误,可以直接根据提示的链接下载对应的包

GDScript3
3 行
 Downloading https://github.com/tauri-apps/binary-releases/releases/download/nsis-3/nsis-3.zip
       Error failed to bundle project: `https://github.com/tauri-apps/binary-releases/releases/download/nsis-3/nsis-3.zip: Connection Failed: Connect error: 由于连接方在一段时间后没有正确
答复或连接的主机没有反应,连接尝试失败。 (os error 10060)`

解压在C:\Users\${User}\AppData\Local\tarui\NSIS这个目录下

下载https://github.com/tauri-apps/binary-releases/releases/download/nsis-plugins-v0/NSIS-ApplicationID.zip解压到NSIS/Plugins目录下

将NSIS-ApplicationID\ReleaseUnicode\ApplicationID.dll复制到NSIS/Plugins/x86-unicode下

下载https://knsay.com/upload/default/20230614/b0c63b57f4729e1d3a245023672df79a.zip,将nsis_tauri_utils.dll复制到NSIS/Plugins/x86-unicode下

代码片段
11 行
--NSIS
	--Plugins
		--Debug
		--DebugUnicode
		--Release
		--ReleaseUnicode
		--x86-ansi
		--x86-unicode
			--ApplicationID.dll
			--nsis_tauri_utils.dll
	--...

然后就可以继续执行npm run tauri build编译。

如果产生类似如下错误,通过提示的链接直接下载对应nsis_tauri_utils.dll复制到NSIS/Plugins/x86-unicode下即可,然后就可以继续执行npm run tauri build编译。

GDScript3
2 行
 Downloading https://github.com/tauri-apps/nsis-tauri-utils/releases/download/nsis_tauri_utils-v0.4.0/nsis_tauri_utils.dll
       Error failed to bundle project: `https://github.com/tauri-apps/nsis-tauri-utils/releases/download/nsis_tauri_utils-v0.4.0/nsis_tauri_utils.dll: Network Error: Network Error: Error encountered in the status line: unexpected end of file`

如果还会产生nsis之类的问题,那么就可能是tarui\NSIS这个目录不对,具体查看github中的源码
https://github.com/tauri-apps/tauri/blob/dev/tooling/bundler/src/bundle/windows/msi.rs

Tauri构建时下载Wix和NSIS失败问题

在Tauri构建时会从github下载Wix和NSIS工具,因为国内网络原因导致下载失败(貌似使用了代理也没用),解决办法是提前下载这两个工具到本地

GDScript3
6 行
Running light to produce X:\Tauri\tauri-shop-admin\src-tauri\target\release\bundle\msi\tauri-shop-admin_0.1.0_x64_en-US.msi
    Warn NSIS directory contains mis-hashed files. Redownloading them.
    Downloading https://github.com/tauri-apps/nsis-tauri-utils/releases/download/nsis_tauri_utils-v0.4.1/nsis_tauri_utils.dll
failed to bundle project: `https://github.com/tauri-apps/nsis-tauri-utils/releases/download/nsis_tauri_utils-v0.4.1/nsis_tauri_utils.dll: Connection Failed: Connect error: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 (os error 10060)`
    Error failed to bundle project: `https://github.com/tauri-apps/nsis-tauri-utils/releases/download/nsis_tauri_utils-v0.4.1/nsis_tauri_utils.dll: Connection Failed: Connect error: 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。 (os error 10060)`
 ELIFECYCLE  Command failed with exit code 1.

快速解决
下面的解决办法还是比较麻烦的,可以先试试这个办法,我将最后的文件夹打包了一份,虽然不保证一定能使用,但如果有用的话可以节约很多时间,在文章顶部可以下载,在gitee也上传了一份 tauri.zip

下载压缩包文件 tauri.zip
找到这个路径 C:\Users\你的用户名\AppData\Local
将压缩包解压到这个文件夹

最后的文件树结构

代码片段
12 行
C:\Users\用户名\AppData\Local\tauri>
├─NSIS
│ ├─Bin
│ ├─Contrib
│ ├─Docs
│ ├─Examples
│ ├─Include
│ ├─Plugins
│ │ ├─x86-ansi
│ │ └─x86-unicode 下载的插件放这里
│ └─Stubs
└─WixTools

如果上面的办法不行的话,可以参照下面的办法

1.下载Wix工具

前往Wix发行页面,下载wix314-binaries.zip压缩包,注意版本号

article image

2.下载NSIS工具

前往Tauri资源下载页面,下载nsis-3.zip

article image

另外还需要下载nsis_tauri_utils.dllNSIS-ApplicationID.zip这两个文件

3.放置文件

找到此路径C:\Users\你的用户名\AppData\Local\tauri 注意替换用户名,tauri文件夹如果不存在可以创建一个
在tauri文件夹下创建WixTools314,将wix314-binaries.zip解压到这个文件夹下
在tauri文件夹下创建NSIS,将nsis-3.zip解压到这个文件夹下
将NSIS-ApplicationID.zip复制到 ...\NSIS\Plugins\x86-unicode,然后将其解压到当前文件夹下
将 nsis_tauri_utils.dll也复制到这个x86-unicode文件夹下
大功告成,再次构建就没问题了

article image

tauri-NSIS-WixTools目录文件夹打包下载

tauri.rar

代码片段
1 行
C:\Users\li\AppData\Local\tauri
article image

编译错误文件包.rar

为了开始使用 Tauri 构建项目,你首先需要安装一些依赖项

前置要求-系统依赖项