wails icon indicating copy to clipboard operation
wails copied to clipboard

Wails serves but won't run with built (win10 amd64)

Open Tekk-Know opened this issue 6 years ago • 26 comments

Description I am unable to get wails to work correctly in my win10 env. Testing with vanilla template without any changes after starting project with 'Wails init'. Following along the 'Installing Wails' I am able to get the clean project to serve / display in localhost, but the 'Wails build' .exe will not run and throws script error. 'Script Error', 'Object doesn't support property or method 'addEventListner', Line: 10, Char: 5.

To Reproduce Steps to reproduce the behaviour:

  1. 'Wails Init' on clean dir and cd into project
  2. 'Wails build -d' in project root
  3. On success, navigate to build dir
  4. Click on 'outputfilename.exe'
  5. See 'Script Error' on screen.

Expected behaviour I expect application to launch w/o error similar to behavior when serving project in localhost / chrome.

Screenshots Screenshot 2020-10-07 125034

System Details

Name Value
Wails Version v1.8.0
Go Version go1.15.2
Platform windows
Arch amd64
GO111MODULE (Not Set)
GCC 9.2.0
Npm 6.14.8
Node v12.18.3

Additional context Add any other context about the problem here.

Tekk-Know avatar Oct 07 '20 17:10 Tekk-Know

The last outputs of the debug console:

time="2020-10-07T15:38:21-05:00" level=debug msg="[WebView] Enabling Wails console"
time="2020-10-07T15:38:21-05:00" level=debug msg="[WebView] Eval" js="(function () {\n\n    window.wailsconsole = {};..."
time="2020-10-07T15:38:21-05:00" level=debug msg="[WebView] Eval" js="!function(n){var t={};function e(r){if(t[r])r..."

Tekk-Know avatar Oct 07 '20 20:10 Tekk-Know

Thanks for reporting this. Will check today.

leaanthony avatar Oct 07 '20 21:10 leaanthony

In the webview.go file: w.eventManager.On("wails:loaded", callback) does not appear to fire before error is thrown, w.window.Run() is reached once.

Tekk-Know avatar Oct 07 '20 21:10 Tekk-Know

Can't reproduce. Installed v1.8.0, created a vanilla app and it worked fine. image

leaanthony avatar Oct 09 '20 05:10 leaanthony

Can't reproduce. Installed v1.8.0, created a vanilla app and it worked fine.

Hmm, what's your environment like? What TDM are you using? Is docker needed for build our just for packaging?

Tekk-Know avatar Oct 09 '20 13:10 Tekk-Know

@leaanthony I cleared out wails from my %gopath%\pkg\mod\github.com\wailsapp and re-downloaded it via 'go get'. I'm showing @v1.8.0. I'm still seeing this issue. I'm running go1.15.2, but I did go ahead and set my "GO111MODULE" env var to "on" per instructions. Issue persists per original description.

Tekk-Know avatar Oct 09 '20 17:10 Tekk-Know

Commenting out the /assets/console.js import in the webview.go file changes the error to Expected Identifier. This matches the error that I receive when I do NOT run build with debug flag. It seems likely that document.addEventListener('keyup', logKey); in the asset/console.js is the line that throws the error. This suggests that document is not resolving correctly.

Tekk-Know avatar Oct 09 '20 17:10 Tekk-Know

The imported code from wails.js when passed through evalJS() causes error during the w.window.eval(js) execution, returning "evaluation failed".

Tekk-Know avatar Oct 09 '20 19:10 Tekk-Know

I used Wails v1.8.0, TDM with gcc 9 & Win 10 Pro 2004. Is your machine old/slow? I'm wondering if it's a timing issues with old PCs. Not seen it myself...

leaanthony avatar Oct 09 '20 19:10 leaanthony

I used Wails v1.8.0, TDM with gcc 9 & Win 10 Pro 2004. Is your machine old/slow? I'm wondering if it's a timing issues with old PCs. Not seen it myself...

I wouldn't consider it to be slow (i7-7820HQ Quad @ 2.9GHz , 16GB RAM).

I'm trying to modify your assets/console.js file but my changes aren't reflected when I build. Is it cached somewhere, or am I mistaken in thinking modifying it in %GOPATH%\pkg\mod\github.com\wailsapp\[email protected]\runtime\assets\console.js will change the file being used by your lib?

Tekk-Know avatar Oct 09 '20 19:10 Tekk-Know

run scripts/build.sh or go run build.go in the scripts directory.

leaanthony avatar Oct 11 '20 02:10 leaanthony

+1

Issue description After creating a fresh project with wails init I tried adding Zendesk's Garden UI kit and inserting a component from that library to the app. When I run wails serve alongside npm run start the app renders correctly and everything is fine. Building the app with wails build -d return the following error box https://gyazo.com/316824143d1964c2aa44a4d3817bc058

App.js

import React from "react";
import { Anchor } from "@zendeskgarden/react-buttons";
import "./App.css";

const App = () => (
  <div className="App">
    <Anchor href="#default">Hey</Anchor>
  </div>
);

export default App;

edit:

Running npm run build on frontend (after removing the lines relative to wails) gives a fully functional production app, and the components are rendered as expected

Rezrazi avatar Oct 17 '20 14:10 Rezrazi

Arrow functions will break IE11 unless you use a polyfill.

leaanthony avatar Oct 17 '20 18:10 leaanthony

@Tekk-Know had issues with the vanilla template yesterday. Investigating.

leaanthony avatar Oct 17 '20 18:10 leaanthony

Arrow functions will break IE11 unless you use a polyfill.

Tried again with both class and function Component definition. Issue persists

Rezrazi avatar Oct 17 '20 20:10 Rezrazi

The only advice I can offer you is include the UIKit code bit by bit from the vanilla template (which works for me now). See what breaks.

leaanthony avatar Oct 17 '20 22:10 leaanthony

part of me is thinking we should inject corejs on windows by default but this may have unintended consequences.

leaanthony avatar Oct 17 '20 22:10 leaanthony

The only advice I can offer you is include the UIKit code bit by bit from the vanilla template (which works for me now). See what breaks.

I tried going this path, adding imports doesn't break the build, but as soon as I include a ui component into the app, whichever it may be, the build breaks, even the simplest components that are just wrappers around HTML elements such as ´H1´ which is a wrapper around the regular ´h1´

Rezrazi avatar Oct 17 '20 22:10 Rezrazi

Well IE11 can certainly render h5 so there must be something else going on. If you put your examples in a repo, I'll have a look.

leaanthony avatar Oct 18 '20 04:10 leaanthony

Well IE11 can certainly render h5 so there must be something else going on. If you put your examples in a repo, I'll have a look.

I've created a simple wails project that recreates the issue encountered, README is provided for details about the issue https://github.com/Rezrazi/wailsgarden

Rezrazi avatar Oct 18 '20 09:10 Rezrazi