Rust / Tauri 构建错误(无法确定应用程序 v0.1.0 的构建脚本的包指纹)这似乎是由 .git 目录引起的

问题描述 投票:0回答:1

我一直面临以下错误,我相信在构建我的 Rust 代码时会抛出该错误。 (我已经能够运行 Rust 测试,但由于某种原因无法运行货物检查,并且当我的 IDE 在启动时运行货物检查时,货物检查失败。)

我在运行 tauri-dev / tauri-build 时也遇到此错误。 (有时可以运行 tauri-dev,但不能运行 tauri-build)

这是我在运行任何命令时收到的错误消息(npm run tauri-dev/tauri build,cargo check/build)

error: failed to determine package fingerprint for build script for app v0.1.0 (C:\{project path}\src-tauri)
An I/O error happened. Please make sure you can access the file.

By default, if your project contains a build script, cargo scans all files in
it to determine whether a rebuild is needed. If you don't expect to access the
file, specify `rerun-if-changed` in your build script.
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed for more information.

Caused by:
  failed to determine the most recently modified file in C:\{project path}\src-tauri

Caused by:
  failed to determine list of files in C:\{project path}\src-tauri

Caused by:
  Could not read repository exclude

Caused by:
  The filename, directory name, or volume label syntax is incorrect. (os error 123)

任何重要的版本:

  • Node.js 版本:21.5.0
  • NPM版本:10.2.4
  • git版本:2.46.0.windows.1
  • 生锈:1.27.1
  • rustc:1.81.0
  • tauri-build:1.5.3
  • tauri-apps/cli:1.6.0
  • tauri-apps/api:1

我很乐意提供任何其他日志,尽管没有一个值得注意,例如我的 NPM 日志是完全标准的。

需要注意的重要一点是,该项目中的实际代码并不重要。无论内容如何(只要我有基本的 tauri main 和构建脚本以及样板 tauri 前端),它都不会构建,并且文件结构是相同的。此外,如果我将项目从其原始目录复制到另一个目录,而不对代码本身进行任何更改,则一切都可以正常运行。

我在访问 Stack Overflow 之前所做的最后一个观察是,我可以通过删除任何完整的 .git 文件(HEAD/INDEX/..etc)来“修复”此错误。只要我不提交更改,这种情况就会持续,并且会在我链接回远程、创建新存储库或拉/推时中断。 (大概是因为它“修复”了我的 .git 目录)

我能够继续从事这个项目,尽管每次都必须修复我的 .git 目录会有点烦恼,而且我更愿意继续使用 GitHub。 (请不要推荐使用其他存储库解决方案,谢谢!)

git rust rust-cargo tauri
1个回答
0
投票

我已经解决了我自己的问题 - 这是我自己的 git 设置特有的问题,尽管我会在这里发布答案,以防其他人遇到这个问题;

正如我所想,我面临的问题是我的 git 配置问题,即使我卸载并重新安装,该问题仍然存在。

我曾尝试为 .env 文件设置通配符 gitignore,这为正则表达式创建了不可能的匹配。

我使用以下命令将其添加到我的 %USERPROFILE%.gitconfig core.excludesFile 部分中:

git config --global core.excludesFile "%USERPROFILE%\.gitignore"

我在重新安装存储库时注意到了这一点,因为它抱怨不可能的匹配。

大概我的项目在没有正确的 .git 的情况下构建的原因是它没有链接回 %USERPROFILE%.gitignore ,因此没有链接到不可能的匹配。无论如何,删除有问题的行已经解决了这个问题。

如果您处于我的位置并且尚未设置全局变量,我建议删除您自己的 .gitignore 文件夹中的所有内容,正如我在运行 tauri dev --verbose 时指出的那样,它将在构建项目时解析每个表达式。

© www.soinside.com 2019 - 2024. All rights reserved.