メインコンテンツにスキップ
バージョン: v2.0.0-beta.43

Troubleshooting

An assortment of troubleshooting tips.

The wails command appears to be missing?

If your system is reporting that the wails command is missing, make sure you have followed the Go installation guide correctly. Normally, it means that the go/bin directory in your User's home directory is not in the PATH environment variable. You will also normally need to close and reopen any open command prompts so that changes to the environment made by the installer are reflected at the command prompt.

My application is displaying a white/blank screen

Check that your application includes the assets from the correct directory. In your main.go file, you will have something similar to the following code:

//go:embed frontend/dist
var assets embed.FS

Check that frontend/dist contains your application assets.

Mac

If this happens on Mac, try adding the following to your Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>

Reference: https://github.com/wailsapp/wails/issues/1504#issuecomment-1174317433

Mac application not valid

If your built application looks like this in finder:

it's likely that your application's info.plist is invalid. Update the file in build/<yourapp>.app/Contents/info.plist and check if the data is valid, EG check the binary name is correct. To persist the changes, copy the file back to the build/darwin directory.

Cannot call backend method from frontend with variadic arguments

If you have a backend method defined with variadic parameters, eg:

func (a *App) TestFunc(msg string, args ...interface{}) error {
// Code
}

calling this method from the frontend like this will fail:

var msg = "Hello: "
var args = ["Go", "JS"]
window.go.main.App.TestFunc(msg, ...args).then((result) => {
//do things here
}).catch((error) => {
//handle error
});

Workaround:

var msg = "Hello "
var args = ["Go", "JS"]
window.go.main.App.TestFunc(msg, args).then((result) => { //without the 3 dots
//do things here
}).catch((error) => {
//handle error
});

Credit: https://github.com/wailsapp/wails/issues/1186

I'm having getting proxy errors when trying to install Wails

If you are getting errors like this:

"https://proxy.golang.org/github.com/wailsapp/wails/cmd/wails/@v/list": dial tcp 172.217.163.49:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

it's probably because the official Go Proxy is being blocked (Users in China have reported this). The solution is to set up the proxy manually, eg:

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

Source: https://github.com/wailsapp/wails/issues/1233

The generated Typescript doesn't have the correct types

Sometimes the generated Typescript doesn't have the correct types. To mitigate this, it is possible to specify what types should be generated using the ts_type struct tag. For more details, please read this.

When I navigate away from index.html, I am unable to call methods on the frontend

If you navigate away from index.html to a new html file, the context will be lost. This can be fixed by adding the following imports to the <head> section of any new page you navigate to:

<head>
<script src="/wails/ipc.js"></script>
<script src="/wails/runtime.js"></script>
</head>

Source: https://github.com/wailsapp/wails/discussions/1512