简体   繁体   中英

Tauri compilation error: STATUS_ACCESS_VIOLATION

I'm trying to use create-tauri-app to set up Tauri (for the first time) on my computer. I initialized it with npm create tauri-app , followed all the prompts and successfully created a project. After moving into the generated directory (I have not modified anything ) and running npm i , I attempt to run npm run tauri dev , as instructed from the prompts by the app generator. Vite started successfully, and after a painfully long compilation of a bunch of cargo packages, I suddenly see this message in the terminal:

error: could not compile `tauri`

Caused by:
  process didn't exit successfully: `rustc --crate-name tauri --edition=2021 C:\Users\[...]\tauri-1.0.5\src\lib.rs [... redacted because way too long]`
  (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

(...and the program crashes with lots of npm junk)

Note: this error was produced by Tauri or some third-party package. I have no control over the code from which the error originates.
I've double-checked everything and spent hours retrying, googling, restarting my computer, and other junk all to no avail. I understand STATUS_ACCESS_VIOLATION has something to do with memory being messed up (seems also to be an error code common in Chromium, so I suspect the culprit is webview2), but I have no idea how to pinpoint the issue.

If helpful, here's my system details as provided by running npx tauri info :

Environment
  › OS: Windows 10.0.18363 X64
  › Webview2: 104.0.1293.47
  › MSVC: 
      - Visual Studio Build Tools 2017
  › Node.js: 14.16.1
  › npm: 6.14.12
  › pnpm: 6.11.0
  › yarn: 1.22.15
  › rustup: 1.25.1
  › rustc: 1.62.1
  › cargo: 1.62.1
  › Rust toolchain: stable-x86_64-pc-windows-gnu 

Packages
  › @tauri-apps/cli [NPM]: 1.0.5
  › @tauri-apps/api [NPM]: 1.0.2
  › tauri [RUST]: 1.0.5,
  › tauri-build [RUST]: 1.0.4,
  › tao [RUST]: 0.12.2,
  › wry [RUST]: 0.19.0,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../dist
  › devPath: http://localhost:5173/
  › framework: Vue.js

App directory structure
  ├─ .vscode
  ├─ node_modules
  ├─ public
  ├─ src
  └─ src-tauri

And here's the package.json for anyone who's interested:

{
  "name": "tauri-app",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "tauri": "tauri"
  },
  "dependencies": {
    "@tauri-apps/api": "^1.0.2",
    "vue": "^3.2.37"
  },
  "devDependencies": {
    "@tauri-apps/cli": "^1.0.5",
    "@vitejs/plugin-vue": "^3.0.0",
    "vite": "^3.0.0"
  }
}

As you can see, I've installed all the required items and nothing seems out of place. Has anyone faced this issue before or have any ideas on how to fix this? I'm desperate to find a solution.

Update

After following a suggestion from a comment that I should be using the msvc Rust toolchain instead of the gnu , the original error is no longer present, but I have a completely different mysterious error about my OS not being supported ( Os { code: 216, kind: Uncategorized, message: "This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher." } ), so this question is no longer awaiting answers (unless you know how to fix the most recent said issue, please comment).

You need Visual Studio Build Tools version 2019 or greater. I was also getting this error with build tools 2017 and installing 2022 resolved it.

Step one of the getting started guide for windows says to install 2022. I believe any version after 2019 will work but I would recommend 2022 as that's what the guide suggests.

Visual Studio Build Tools 2022

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM