tauri-apps / vue-cli-plugin-tauri

Turn your Vue SPA into a lightweight cross-platform desktop app
https://tauri.studio
MIT License
372 stars 23 forks source link

Build of Vue.js 3 app on WSL2-Ubuntu fails #34

Closed fkromer closed 3 years ago

fkromer commented 3 years ago

Describe the bug

If I try to build a Vue.js 3 app I get a compilation error:

florian@DESKTOP-AHMD318:~/github/taunorris$ npm run tauri:build

> taunorris@0.1.0 tauri:build
> vue-cli-service tauri:build⠸  Building for production...

 DONE  Compiled successfully in 2813ms                                                                                                              1:53:30 PM

  File                                                          Size                                          Gzipped

  src-tauri/target/webpack_dist/js/chunk-vendors.37c1e350.js    140.12 KiB                                    48.10 KiB
  src-tauri/target/webpack_dist/js/app.37d84ca3.js              4.99 KiB                                      1.97 KiB
  src-tauri/target/webpack_dist/css/app.9770c80a.css            1.84 KiB                                      0.51 KiB

  Images and other types of assets omitted.

 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

 app:spawn Running "/home/florian/github/taunorris/node_modules/@tauri-apps/cli/bin/tauri-cli tauri build --config {"build":{"distDir":"./target/webpack_dist"}}" +0ms

thread 'main' panicked at 'Couldn't recognize the current folder as a Tauri project.', src/helpers/app_paths.rs:29:3
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

 app:spawn Command "/home/florian/github/taunorris/node_modules/@tauri-apps/cli/bin/tauri-cli" failed with exit code: 101 +0ms
/home/florian/github/taunorris/node_modules/@tauri-apps/cli/dist/api/cli.js:1
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.tauri=t():e.tauri=t()}(this,(function(){return e={210:e=>{e.exports={workspace:{},package:{name:"tauri-cli",version:"1.0.0-beta.1",authors:["Tauri Programme within The Commons Conservancy"],edition:"2018",categories:["gui","web-programming"],license:"Apache-2.0 OR MIT",homepage:"https://tauri.studio",repository:"https://github.com/tauri-apps/tauri",description:"Command line interface for building Tauri apps",include:["src/","/templates","MergeModules/","*.json","*.rs"]},bin:[{name:"cargo-tauri",path:"src/main.rs"}],dependencies:{clap:{version:"3.0.0-beta.2",features:["yaml"]},anyhow:"1.0","tauri-bundler":{version:"1.0.0-beta.0",path:"../bundler"},colored:"2.0",once_cell:"1.7",serde:{version:"1.0",features:["derive"]},serde_json:"1.0",serde_with:"1.9",notify:"4.0",shared_child:"0.3",toml_edit:"0.2","json-patch":"0.2",schemars:"0.8",toml:"0.5.8",valico:"3.6",handlebars:"3.5",include_dir:"0.6",minisign:"0.6",base64:"0.13.0",ureq:"2.1",os_info:"3.0",semver:"0.11",regex:"1.5",lazy_static:"1",libc:"0.2",terminal_size:"0.1.16","unicode-width":"0.1",tempfile:"3",zeroize:"1.3.0"},target:{"cfg(windows)":{dependencies:{winapi:{version:"0.3",features:["winbase","winuser","consoleapi","processenv","wincon"]},encode_unicode:"0.3"}},'cfg(target_os = "linux")':{dependencies:{heck:"0.3"}}},"build-dependencies":{schemars:"0.8",serde:{version:"1.0",features:["derive"]},serde_json:"1.0",serde_with:"1.9"}}},857:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.build=t.dev=t.init=void 0;var o=n(889);function s(e,t){return r(this,void 0,void 0,(function(){var n,r,s,a,u,c;return i(this,(function(i){switch(i.label){case 0:for(n=[],r=0,s=Object.entries(t);r<s.length;r++)a=s[r],u=a[0],!1!==(c=a[1])&&(n.push("--"+u.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase()),!0!==c&&n.push("string"==typeof c?c:JSON.stringify(c)));return[4,o.runOnRustCli(e,n)];case 1:return[2,i.sent()]}}))}))}t.init=function(e){return r(void 0,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,s("init",e)];case 1:return[2,t.sent()]}}))}))},t.dev=function(e){return r(void 0,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,s("dev",e)];case 1:return[2,t.sent()]}}))}))},t.build=function(e){return r(void 0,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,s("build",e)];case 1:return[2,t.sent()]}}))}))}},632:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.downloadRustup=t.downloadCli=void 0;var s=o(n(413)),a=n(669),u=o(n(747)),c=o(n(301)),l=o(n(622)),f=a.promisify(s.default.pipeline),d=n(210),p={};function h(e,t,n){return r(this,void 0,void 0,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return r="https://github.com/tauri-apps/binary-releases/releases/download/"+e+"/"+t,o=function(){try{r in p||u.default.unlinkSync(n)}finally{process.exit()}},process.on("exit",o),process.on("SIGINT",o),process.on("SIGTERM",o),process.on("SIGHUP",o),process.on("SIGBREAK",o),[4,f(c.default.stream(r),u.default.createWriteStream(n)).catch((function(e){throw o(),e}))];case 1:return i.sent(),p[r]=!0,u.default.chmodSync(n,448),console.log("Download Complete"),[2]}}))}))}t.downloadCli=function(){return r(this,void 0,void 0,(function(){var e,t,n,r;return i(this,(function(i){switch(i.label){case 0:if(e=d.package.version,"win32"===(t=process.platform))t="windows";else if("linux"===t)t="linux";else{if("darwin"!==t)throw Error("Unsupported platform");t="macos"}return n="windows"===t?".exe":"",r=l.default.join(__dirname,"../../bin/tauri-cli"+n),console.log("Downloading Rust CLI..."),[4,h("tauri-cli-v"+e,"tauri-cli_"+t+n,r)];case 1:return i.sent(),[2]}}))}))},t.downloadRustup=function(){return r(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return e="win32"===process.platform?"rustup-init.exe":"rustup-init.sh",console.log("Downloading Rustup..."),[4,h("rustup",e,l.default.join(__dirname,"../../bin/"+e))];case 1:return[2,t.sent()]}}))}))}},976:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i,o=r(n(242)),s=r(n(517));t.default=function(e,t){return void 0===t&&(t=o.default.green),function(n){var r=+new Date,a=r-(i||r);i=r,n?console.log(" "+t(String(e))+" "+n+" "+o.default.green("+"+s.default(a))):console.log()}}},889:function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},o=this&&this.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;n<r;n++,i++)e[i]=t[n];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.runOnRustCli=void 0;var s=n(747),a=n(622),u=n(71),c=n(632);t.runOnRustCli=function(e,t){return r(this,void 0,void 0,(function(){var r,l,f,d,p,h,v,w,b;return i(this,(function(i){switch(i.label){case 0:return r=a.resolve(__dirname,"../.."),l=a.join(r,"bin/tauri-cli"+("win32"===process.platform?".exe":"")),h=new Promise((function(e,t){f=e,d=function(){return t(new Error)}})),v=function(e,t){0===e?f():d()},s.existsSync(l)?(p=u.spawn(l,o(["tauri",e],t),process.cwd(),v),[3,4]):[3,1];case 1:return[4,c.downloadCli()];case 2:return i.sent(),p=u.spawn(l,o(["tauri",e],t),process.cwd(),v),[3,4];case 3:s.existsSync(a.resolve(r,"../bundler"))?(w=a.resolve(r,"../cli.rs"),u.spawnSync("cargo",["build","--release"],w),b=a.resolve(r,"../cli.rs/target/release/cargo-tauri"),p=u.spawn(b,o(["tauri",e],t),process.cwd(),v)):(u.spawnSync("cargo",["install","--root",r,"tauri-cli","--version",n(210).package.version],process.cwd()),p=u.spawn(l,o(["tauri",e],t),process.cwd(),v)),i.label=4;case 4:return[2,{pid:p,promise:h}]}}))}))}},71:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.spawnSync=t.spawn=void 0;var i=r(n(793)),o=r(n(976)),s=r(n(242)),a=o.default("app:spawn"),u=o.default("app:spawn",s.default.red);t.spawn=function(e,t,n,r){a('Running "'+e+" "+t.join(" ")+'"'),a();var o=i.default(e,t,{stdio:"inherit",cwd:n,env:process.env});return o.on("close",(function(t){a(),t&&a('Command "'+e+'" failed with exit code: '+t),r&&r(null!=t?t:0,o.pid)})),o.pid},t.spawnSync=function(e,t,n,r){a('[sync] Running "'+e+" "+t.join(" ")+'"'),a();var o=i.default.sync(e,t,{stdio:"inherit",cwd:n});(o.status||o.error)&&(u(),u('⚠️  Command "'+e+'" failed with exit code: '+o.status),null===o.status&&u('⚠️  Please globally install "'+e+'"'),r&&r(),process.exit(1))}},242:e=>{"use strict";e.exports=require("chalk")},793:e=>{"use strict";e.exports=require("cross-spawn")},747:e=>{"use strict";e.exports=require("fs")},301:e=>{"use strict";e.exports=require("got")},517:e=>{"use strict";e.exports=require("ms")},622:e=>{"use strict";e.exports=require("path")},413:e=>{"use strict";e.exports=require("stream")},669:e=>{"use strict";e.exports=require("util")}},t={},function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}(857);var e,t}));

Error
    at d (/home/florian/github/taunorris/node_modules/@tauri-apps/cli/dist/api/cli.js:1:9485)
    at v (/home/florian/github/taunorris/node_modules/@tauri-apps/cli/dist/api/cli.js:1:9526)
    at ChildProcess.<anonymous> (/home/florian/github/taunorris/node_modules/@tauri-apps/cli/dist/api/cli.js:1:10657)
    at ChildProcess.emit (node:events:394:28)
    at maybeClose (node:internal/child_process:1067:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
florian@DESKTOP-AHMD318:~/github/taunorris$

To Reproduce

Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

florian@DESKTOP-AHMD318:~/github/taunorris$ vue info | grep vue-cli-plugin-tauri
    vue-cli-plugin-tauri: ~1.0.0-beta.2 => 1.0.0-beta.2
florian@DESKTOP-AHMD318:~/github/taunorris$ vue info

Environment Info:

  System:
    OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa)
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 16.3.0 - ~/.nvm/versions/node/v16.3.0/bin/node
    Yarn: Not Found
    npm: 7.15.1 - ~/.nvm/versions/node/v16.3.0/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.2.1 
    @vue/babel-helper-vue-transform-on:  1.0.2 
    @vue/babel-plugin-jsx:  1.0.6 
    @vue/babel-plugin-transform-vue-jsx:  1.2.1 
    @vue/babel-preset-app:  4.5.13 
    @vue/babel-preset-jsx:  1.2.4 
    @vue/babel-sugar-composition-api-inject-h:  1.2.1 
    @vue/babel-sugar-composition-api-render-instance:  1.2.4 
    @vue/babel-sugar-functional-vue:  1.2.2 
    @vue/babel-sugar-inject-h:  1.2.2 
    @vue/babel-sugar-v-model:  1.2.3 
    @vue/babel-sugar-v-on:  1.2.3 
    @vue/cli-overlay:  4.5.13 
    @vue/cli-plugin-babel: ~4.5.0 => 4.5.13 
    @vue/cli-plugin-eslint: ~4.5.0 => 4.5.13 
    @vue/cli-plugin-router:  4.5.13 
    @vue/cli-plugin-typescript: ~4.5.0 => 4.5.13 
    @vue/cli-plugin-vuex: ~4.5.0 => 4.5.13 
    @vue/cli-service: ~4.5.0 => 4.5.13 
    @vue/cli-shared-utils:  4.5.13 
    @vue/compiler-core:  3.1.1 
    @vue/compiler-dom:  3.1.1 
    @vue/compiler-sfc: ^3.0.0 => 3.1.1 
    @vue/compiler-ssr:  3.1.1 
    @vue/component-compiler-utils:  3.2.1 
    @vue/devtools-api:  6.0.0-beta.14 
    @vue/eslint-config-prettier: ^6.0.0 => 6.0.0 
    @vue/eslint-config-typescript: ^7.0.0 => 7.0.0 
    @vue/preload-webpack-plugin:  1.1.2 
    @vue/reactivity:  3.1.1 
    @vue/runtime-core:  3.1.1 
    @vue/runtime-dom:  3.1.1 
    @vue/shared:  3.1.1 
    @vue/web-component-wrapper:  1.3.0 
    eslint-plugin-vue: ^7.0.0 => 7.11.1 
    typescript: ~4.1.5 => 4.1.5 
    vue: ^3.0.0 => 3.1.1 
    vue-axios: ^3.2.4 => 3.2.4 
    vue-cli-plugin-tauri: ~1.0.0-beta.2 => 1.0.0-beta.2 
    vue-eslint-parser:  7.6.0 
    vue-hot-reload-api:  2.3.4 
    vue-loader:  15.9.7 (16.2.0)
    vue-style-loader:  4.1.3 
    vue-template-es2015-compiler:  1.9.1 
    vuex: ^4.0.0-0 => 4.0.1 
  npmGlobalPackages:
    @vue/cli: 4.5.13
florian@DESKTOP-AHMD318:~/github/taunorris$ npx tauri info
 app:spawn Running "/home/florian/github/taunorris/node_modules/@tauri-apps/cli/bin/tauri-cli tauri info" +0ms

Operating System - Ubuntu, version 20.04 X64

Node.js environment
  Node.js - 16.3.0
  @tauri-apps/cli - 1.0.0-beta.1 (outdated, latest: 1.0.0-beta.2)

Global packages
  npm - 7.15.1
  yarn - 0.32+git

Rust environment
  rustc - 1.47.0
  cargo - 1.46.0

Additional context Add any other context about the problem here.

fkromer commented 3 years ago

Probably Vue.js 3 is just not supported yet. The only Tauri project using Vue.js I've found so far is jwenjian/lucky-you which uses Vue.js 2.

nothingismagick commented 3 years ago

Your rust is out of date. It should be 1.52.1. I know for a fact that vue3 will work in tauri.

fkromer commented 3 years ago

Sorry for the false positive. You are right. I had an outdated Rust installed. Build works just fine.