tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
85.21k stars 2.58k forks source link

[bug] Bundling fails with 'GenericFailure'on candle.exe #4594

Closed Flavsditz closed 2 years ago

Flavsditz commented 2 years ago

Describe the bug

I have successfully developed and bundled my app for Linux. In the past I have also done a windows bundle, but now when I run tauri:build (runs the vue-cli-service tauri:build) the Vue part bundles correctly and the subsequent part fails.

Reproduction

No response

Expected behavior

I expect a .exe to be outputed

Platform and versions

Operating System - Windows, version 10.0.19044 X64
Webview2 - 103.0.1264.44
Visual Studio Build Tools:
   - Visual Studio Build Tools 2019

Node.js environment
  Node.js - 16.15.1
  @tauri-apps/cli - 1.0.0-rc.4 (outdated, latest: 1.0.2)
  @tauri-apps/api - 1.0.1

Global packages
  npm - 8.11.0
  pnpm - Not installed
  yarn - Not installed

Rust environment
  rustup - 1.24.3
  rustc - 1.62.0
  cargo - 1.62.0
  toolchain - stable-x86_64-pc-windows-msvc 

App directory structure
/.idea
/dist
/node_modules
/public
/src
/src-tauri
/webpage
App
  tauri - 1.0.2
  tauri-build - 1.0.2
  tao - 0.12.1
  wry - 0.19.0
  build-type - bundle
  CSP - unset
  distDir - Set automatically by Vue CLI plugin
  devPath - Set automatically by Vue CLI plugin
  framework - Vue.js (Vue CLI)
  bundler - Webpack

Stack trace

DONE  Build complete. The src-tauri\target\webpack_dist directory is ready to be deployed.
 INFO  Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html

   Compiling app v0.1.0 (C:\Users\dev\Downloads\tauri-app\src-tauri)
    Finished release [optimized] target(s) in 36.18s
        Info Target: x64 timing npm:load Completed in 42ms
     Running candle for "main.wxs"
node:internal/process/promises:246m:load Completed in 42ms
          triggerUncaughtException(err, true /* fromPromise */);
          ^

[Error: failed to bundle project: error running candle.exe: error running candle.exe: ``] {
  code: 'GenericFailure'
}
npm timing command:run Completed in 97889ms
npm verb exit 1
npm timing npm Completed in 97979ms
npm verb code 1

Process finished with exit code 1

Additional context

When I run cargo tauri infoit shows that the tauri-cli is outdated in the Node.js environment, but I cannot seem to be able to update that one (maybe this is the issue?). All the tauri dependencies in my project are otherwise up-to-date

Flavsditz commented 2 years ago

Had exactly the same error using the github action proposed on the website so I can rule out that my machine is incorrectly configured and assume it is something I have on the project. I've fixed another issue which was present in the pipeline but got the exact same mistake (check https://github.com/tauri-apps/tauri-action/issues/288 for more info)

lucasfernog commented 2 years ago

Running npm run tauri:build -- --verbose will output more information.

lucasfernog commented 2 years ago

Btw your CLI is super outdated, you should update to v1.0.2.

lucasfernog commented 2 years ago

ahh actually there's a bug in the vue plugin that prevents you from updating :(

Flavsditz commented 2 years ago

Yeah I've tried to update everything I can but I cannot for the life of me get the CLI updated. I am happy to hear that I wasn't just going crazy and it could be a bug.

But does the CLI can update itself? Because the project is up-to-date and I couldn't find it also installed as a global dependency. I cannot find out where that Node.js environment information is coming from

lucasfernog commented 2 years ago

Node.js information comes from the tauri info command, provided by @tauri-apps/cli. We need to update the vue-cli-plugin-tauri first so the CLI can be updated, we're preparing a release for it. You could also remove the plugin and use the CLI directly, though you'd need to fill devPath and distDir in tauri.conf.json.

Flavsditz commented 2 years ago

ok but this dependency to the @tauri-apps/cli is not taken from the package.json?

I mean if I look at my package.json that dependency is up-to-date:

...
"dependencies": {
    "@tauri-apps/api": "^1.0.1",
    "@tauri-apps/cli": "^1.0.2",
    "axios": "^0.27.2",
    "core-js": "^3.23.3",
    "exceljs": "^4.3.0",
    "jsonwebtoken": "^8.5.1",
    "vue": "^2.6.14",
    "vue-class-component": "^7.2.6",
    "vue-property-decorator": "^9.1.2",
    "vue-router": "^3.5.4",
    "vuex": "^3.6.2"
  },
  "devDependencies": {
    "@tailwindcss/postcss7-compat": "^2.2.17",
    "@types/exceljs": "^1.3.0",
    "@typescript-eslint/eslint-plugin": "^4.33.0",
    "@typescript-eslint/parser": "^4.33.0",
    "@vue/cli-plugin-babel": "~4.5.19",
    "@vue/cli-plugin-eslint": "~4.5.19",
    "@vue/cli-plugin-router": "~4.5.19",
    "@vue/cli-plugin-typescript": "~4.5.19",
    "@vue/cli-plugin-vuex": "~4.5.19",
    "@vue/cli-service": "~4.5.19",
    "@vue/eslint-config-prettier": "^6.0.0",
    "@vue/eslint-config-typescript": "^7.0.0",
    "autoprefixer": "^9",
    "eslint": "^6.8.0",
    "eslint-plugin-prettier": "^3.4.1",
    "eslint-plugin-vue": "^6.2.2",
    "lint-staged": "^13.0.3",
    "postcss": "^7",
    "prettier": "^2.7.1",
    "prettier-plugin-tailwindcss": "^0.1.11",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",
    "typescript": "~4.4.4",
    "vue-cli-plugin-tailwind": "~3.0.0",
    "vue-cli-plugin-tauri": "~1.0.0-rc.3",
    "vue-template-compiler": "^2.7.0"
  },
...

But I still have it showing as that release candidate with tauri info (1.0.0-rc.4)

lucasfernog commented 2 years ago

Yeah because vue-cli-plugin-tauri also has a dependency on @tauri-apps/cli, and we didn't update it to 1.0.0 yet.

Flavsditz commented 2 years ago

ahhh I see! Thank you so much for all the patience and explanations @lucasfernog

Flavsditz commented 2 years ago

I was doing some experimentation and I've tried to commit my node_modules folder (also the benefit of speeding up the pipeline) with the up-to-date contents of the vue-cli-plugin-tauri from the repo, where the dependencies are updated at least.

The build failed with:

Run tauri-apps/tauri-action@dev
running npm [ 'run', 'tauri:build' ]
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
 ERROR  Error: Cannot find module '@tauri-apps/cli-win32-x64-msvc'
Require stack:
- D:\a\fusionauth-admin\fusionauth-admin\node_modules\@tauri-apps\cli\index.js
- D:\a\fusionauth-admin\fusionauth-admin\node_modules\@tauri-apps\cli\main.js
- D:\a\fusionauth-admin\fusionauth-admin\node_modules\vue-cli-plugin-tauri\index.js
- D:\a\fusionauth-admin\fusionauth-admin\node_modules\@vue\cli-service\lib\Service.js
- D:\a\fusionauth-admin\fusionauth-admin\node_modules\@vue\cli-service\bin\vue-cli-service.js
Error: Cannot find module '@tauri-apps/cli-win32-x64-msvc'
Require stack:
- D:\a\fusionauth-admin\fusionauth-admin\node_modules\@tauri-apps\cli\index.js
- D:\a\fusionauth-admin\fusionauth-admin\node_modules\@tauri-apps\cli\main.js
- D:\a\fusionauth-admin\fusionauth-admin\node_modules\vue-cli-plugin-tauri\index.js
- D:\a\fusionauth-admin\fusionauth-admin\node_modules\@vue\cli-service\lib\Service.js
- D:\a\fusionauth-admin\fusionauth-admin\node_modules\@vue\cli-service\bin\vue-cli-service.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (D:\a\test-tauri-app\test-tauri-app\node_modules\@tauri-apps\cli\index.js:65:29)
    at Module._compile (node:internal/modules/cjs/loader:1105:[14](https://github.com/Flavsditz/test-tauri-app/runs/7209730433?check_suite_focus=true#step:7:15))
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1[15](https://github.com/Flavsditz/test-tauri-app/runs/7209730433?check_suite_focus=true#step:7:16)9:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:[19](https://github.com/Flavsditz/test-tauri-app/runs/7209730433?check_suite_focus=true#step:7:20))
lucasfernog commented 2 years ago

@Flavsditz it's a little bit harder to use a local CLI, you'd need to build it. I've updated the plugin, can you update vue-cli-plugin-tauri to 1.0.0 and try again?

lucasfernog commented 2 years ago

Closing due to inactivity. Please reopen if it still does not work.