5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 18:42:23 +08:00
wails/website/docs/guides/troubleshooting.mdx
Lea Anthony 583b3cd1c3
New Crowdin updates (#1800)
* New translations markdown-page.md (Acholi)
[ci skip]

* New translations stats.mdx (Acholi)
[ci skip]

* New translations code.json (Acholi)
[ci skip]

* New translations options.json (Acholi)
[ci skip]

* New translations current.json (Acholi)
[ci skip]

* New translations version-v2.0.0-beta.43.json (Acholi)
[ci skip]

* New translations helloworld.mdx (Acholi)
[ci skip]

* New translations footer.json (Acholi)
[ci skip]

* New translations navbar.json (Acholi)
[ci skip]

* New translations emailit.mdx (Acholi)
[ci skip]

* New translations modalfilemanager.mdx (Acholi)
[ci skip]

* New translations linux.mdx (Acholi)
[ci skip]

* New translations scriptbar.mdx (Acholi)
[ci skip]

* New translations minecraftupdater.mdx (Acholi)
[ci skip]

* New translations faq.mdx (Acholi)
[ci skip]

* New translations community-guide.mdx (Acholi)
[ci skip]

* New translations vscode.mdx (Acholi)
[ci skip]

* New translations 2021-09-27-v2-beta1-release-notes.mdx (Acholi)
[ci skip]

* New translations _category_.json (Acholi)
[ci skip]

* New translations templates.mdx (Acholi)
[ci skip]

* New translations _category_.json (Acholi)
[ci skip]

* New translations troubleshooting.mdx (Acholi)
[ci skip]

* New translations windows-installer.mdx (Acholi)
[ci skip]

* New translations windows.mdx (Acholi)
[ci skip]

* New translations howdoesitwork.mdx (Acholi)
[ci skip]

* New translations introduction.mdx (Acholi)
[ci skip]

* New translations cli.mdx (Acholi)
[ci skip]

* New translations _category_.json (Acholi)
[ci skip]

* New translations _category_.json (Acholi)
[ci skip]

* New translations _category_.json (Acholi)
[ci skip]

* New translations _category_.json (Acholi)
[ci skip]

* New translations _category_.json (Acholi)
[ci skip]

* New translations window.mdx (Acholi)
[ci skip]

* New translations menus.mdx (Acholi)
[ci skip]

* New translations options.mdx (Acholi)
[ci skip]

* New translations project-config.mdx (Acholi)
[ci skip]

* New translations _category_.json (Acholi)
[ci skip]

* New translations browser.mdx (Acholi)
[ci skip]

* New translations dialog.mdx (Acholi)
[ci skip]

* New translations events.mdx (Acholi)
[ci skip]

* New translations intro.mdx (Acholi)
[ci skip]

* New translations log.mdx (Acholi)
[ci skip]

* New translations menu.mdx (Acholi)
[ci skip]

* New translations dogsapi.mdx (Acholi)
[ci skip]

* New translations templates.mdx (Chinese Simplified)
[ci skip]

* New translations templates.mdx (Russian)
[ci skip]

* New translations templates.mdx (Japanese)
[ci skip]

* New translations templates.mdx (Korean)
[ci skip]

* New translations troubleshooting.mdx (Chinese Simplified)
[ci skip]

* New translations templates.mdx (Acholi)
[ci skip]

* New translations encrypteasy.mdx (Japanese)
[ci skip]

* New translations wally.mdx (Korean)
[ci skip]

* New translations wally.mdx (Japanese)
[ci skip]

* New translations wally.mdx (Russian)
[ci skip]

* New translations wally.mdx (Chinese Simplified)
[ci skip]

* New translations wombat.mdx (Japanese)
[ci skip]

* New translations wombat.mdx (Korean)
[ci skip]

* New translations wombat.mdx (Russian)
[ci skip]

* New translations wombat.mdx (Chinese Simplified)
[ci skip]

* New translations ytd.mdx (Japanese)
[ci skip]

* New translations ytd.mdx (Korean)
[ci skip]

* New translations ytd.mdx (Russian)
[ci skip]

* New translations ytd.mdx (Chinese Simplified)
[ci skip]

* New translations encrypteasy.mdx (Korean)
[ci skip]

* New translations october.mdx (Japanese)
[ci skip]

* New translations encrypteasy.mdx (Russian)
[ci skip]

* New translations encrypteasy.mdx (Chinese Simplified)
[ci skip]

* New translations filehound.mdx (Japanese)
[ci skip]

* New translations filehound.mdx (Korean)
[ci skip]

* New translations filehound.mdx (Russian)
[ci skip]

* New translations filehound.mdx (Chinese Simplified)
[ci skip]

* New translations mollywallet.mdx (Japanese)
[ci skip]

* New translations mollywallet.mdx (Korean)
[ci skip]

* New translations mollywallet.mdx (Russian)
[ci skip]

* New translations mollywallet.mdx (Chinese Simplified)
[ci skip]

* New translations october.mdx (Korean)
[ci skip]

* New translations october.mdx (Russian)
[ci skip]

* New translations october.mdx (Chinese Simplified)
[ci skip]

* New translations optimus.mdx (Japanese)
[ci skip]

* New translations optimus.mdx (Korean)
[ci skip]

* New translations optimus.mdx (Russian)
[ci skip]

* New translations optimus.mdx (Chinese Simplified)
[ci skip]

* New translations portfall.mdx (Japanese)
[ci skip]

* New translations portfall.mdx (Korean)
[ci skip]

* New translations portfall.mdx (Russian)
[ci skip]

* New translations portfall.mdx (Chinese Simplified)
[ci skip]

* New translations scriptbar.mdx (Russian)
[ci skip]

* New translations emailit.mdx (Japanese)
[ci skip]

* New translations emailit.mdx (Korean)
[ci skip]

* New translations emailit.mdx (Russian)
[ci skip]

* New translations emailit.mdx (Chinese Simplified)
[ci skip]

* New translations modalfilemanager.mdx (Japanese)
[ci skip]

* New translations modalfilemanager.mdx (Korean)
[ci skip]

* New translations modalfilemanager.mdx (Russian)
[ci skip]

* New translations modalfilemanager.mdx (Chinese Simplified)
[ci skip]

* New translations scriptbar.mdx (Japanese)
[ci skip]

* New translations scriptbar.mdx (Korean)
[ci skip]

* New translations scriptbar.mdx (Chinese Simplified)
[ci skip]

* New translations minecraftupdater.mdx (Japanese)
[ci skip]

* New translations minecraftupdater.mdx (Korean)
[ci skip]

* New translations minecraftupdater.mdx (Russian)
[ci skip]

* New translations minecraftupdater.mdx (Chinese Simplified)
[ci skip]

* New translations troubleshooting.mdx (Chinese Simplified)
[ci skip]

* New translations optimus.mdx (Acholi)
[ci skip]

* New translations portfall.mdx (Acholi)
[ci skip]

* New translations wally.mdx (Acholi)
[ci skip]

* New translations october.mdx (Acholi)
[ci skip]

* New translations mollywallet.mdx (Acholi)
[ci skip]

* New translations filehound.mdx (Acholi)
[ci skip]

* New translations encrypteasy.mdx (Acholi)
[ci skip]

* New translations wombat.mdx (Acholi)
[ci skip]

* New translations ytd.mdx (Acholi)
[ci skip]

* New translations scriptbar.mdx (Acholi)
[ci skip]

* New translations minecraftupdater.mdx (Acholi)
[ci skip]

* New translations modalfilemanager.mdx (Acholi)
[ci skip]

* New translations emailit.mdx (Acholi)
[ci skip]

* New translations troubleshooting.mdx (Japanese)
[ci skip]

* New translations troubleshooting.mdx (Korean)
[ci skip]

* New translations troubleshooting.mdx (Russian)
[ci skip]

* New translations troubleshooting.mdx (Chinese Simplified)
[ci skip]

* New translations troubleshooting.mdx (Acholi)
[ci skip]

* New translations troubleshooting.mdx (Chinese Simplified)
[ci skip]

* New translations troubleshooting.mdx (Chinese Simplified)
[ci skip]

* New translations building.mdx (Japanese)
[ci skip]

* New translations 2021-11-08-v2-beta2-release-notes.mdx (Japanese)
[ci skip]

* New translations howdoesitwork.mdx (Chinese Simplified)
[ci skip]

* New translations introduction.mdx (Japanese)
[ci skip]

* New translations introduction.mdx (Korean)
[ci skip]

* New translations introduction.mdx (Russian)
[ci skip]

* New translations introduction.mdx (Chinese Simplified)
[ci skip]

* New translations 2021-09-27-v2-beta1-release-notes.mdx (Japanese)
[ci skip]

* New translations 2021-09-27-v2-beta1-release-notes.mdx (Korean)
[ci skip]

* New translations 2021-09-27-v2-beta1-release-notes.mdx (Russian)
[ci skip]

* New translations 2021-09-27-v2-beta1-release-notes.mdx (Chinese Simplified)
[ci skip]

* New translations 2021-11-08-v2-beta2-release-notes.mdx (Korean)
[ci skip]

* New translations howdoesitwork.mdx (Korean)
[ci skip]

* New translations 2021-11-08-v2-beta2-release-notes.mdx (Russian)
[ci skip]

* New translations 2021-11-08-v2-beta2-release-notes.mdx (Chinese Simplified)
[ci skip]

* New translations 2022-02-22-v2-beta3-release-notes.mdx (Japanese)
[ci skip]

* New translations 2022-02-22-v2-beta3-release-notes.mdx (Korean)
[ci skip]

* New translations 2022-02-22-v2-beta3-release-notes.mdx (Russian)
[ci skip]

* New translations 2022-02-22-v2-beta3-release-notes.mdx (Chinese Simplified)
[ci skip]

* New translations dogsapi.mdx (Japanese)
[ci skip]

* New translations dogsapi.mdx (Korean)
[ci skip]

* New translations dogsapi.mdx (Russian)
[ci skip]

* New translations dogsapi.mdx (Chinese Simplified)
[ci skip]

* New translations howdoesitwork.mdx (Russian)
[ci skip]

* New translations howdoesitwork.mdx (Japanese)
[ci skip]

* New translations building.mdx (Korean)
[ci skip]

* New translations ides.mdx (Chinese Simplified)
[ci skip]

* New translations building.mdx (Russian)
[ci skip]

* New translations building.mdx (Chinese Simplified)
[ci skip]

* New translations installation.mdx (Korean)
[ci skip]

* New translations dynamic-assets.mdx (Japanese)
[ci skip]

* New translations dynamic-assets.mdx (Korean)
[ci skip]

* New translations dynamic-assets.mdx (Russian)
[ci skip]

* New translations dynamic-assets.mdx (Chinese Simplified)
[ci skip]

* New translations ides.mdx (Japanese)
[ci skip]

* New translations ides.mdx (Korean)
[ci skip]

* New translations ides.mdx (Russian)
[ci skip]

* New translations windows-installer.mdx (Japanese)
[ci skip]

* New translations helloworld.mdx (Chinese Simplified)
[ci skip]

* New translations windows-installer.mdx (Korean)
[ci skip]

* New translations windows-installer.mdx (Russian)
[ci skip]

* New translations windows-installer.mdx (Chinese Simplified)
[ci skip]

* New translations options.mdx (Japanese)
[ci skip]

* New translations options.mdx (Korean)
[ci skip]

* New translations options.mdx (Russian)
[ci skip]

* New translations options.mdx (Chinese Simplified)
[ci skip]

* New translations helloworld.mdx (Japanese)
[ci skip]

* New translations helloworld.mdx (Korean)
[ci skip]

* New translations helloworld.mdx (Russian)
[ci skip]

* New translations building.mdx (Acholi)
[ci skip]

* New translations dynamic-assets.mdx (Acholi)
[ci skip]

* New translations ides.mdx (Acholi)
[ci skip]

* New translations windows-installer.mdx (Acholi)
[ci skip]

* New translations howdoesitwork.mdx (Acholi)
[ci skip]

* New translations introduction.mdx (Acholi)
[ci skip]

* New translations options.mdx (Acholi)
[ci skip]

* New translations helloworld.mdx (Acholi)
[ci skip]

* New translations 2021-09-27-v2-beta1-release-notes.mdx (Acholi)
[ci skip]

* New translations 2021-11-08-v2-beta2-release-notes.mdx (Acholi)
[ci skip]

* New translations 2022-02-22-v2-beta3-release-notes.mdx (Acholi)
[ci skip]

* New translations dogsapi.mdx (Acholi)
[ci skip]

* New translations troubleshooting.mdx (Japanese)
[ci skip]

* New translations troubleshooting.mdx (Korean)
[ci skip]

* New translations troubleshooting.mdx (Russian)
[ci skip]

* New translations troubleshooting.mdx (Chinese Simplified)
[ci skip]

* New translations window.mdx (Japanese)
[ci skip]

* New translations window.mdx (Korean)
[ci skip]

* New translations window.mdx (Russian)
[ci skip]

* New translations window.mdx (Chinese Simplified)
[ci skip]

* New translations troubleshooting.mdx (Acholi)
[ci skip]

* New translations window.mdx (Acholi)
[ci skip]

* New translations troubleshooting.mdx (Chinese Simplified)
[ci skip]

* New translations installation.mdx (Korean)
[ci skip]

* New translations troubleshooting.mdx (Japanese)
[ci skip]

* New translations troubleshooting.mdx (Korean)
[ci skip]

* New translations troubleshooting.mdx (Russian)
[ci skip]

* New translations troubleshooting.mdx (Chinese Simplified)
[ci skip]

* New translations window.mdx (Japanese)
[ci skip]

* New translations window.mdx (Korean)
[ci skip]

* New translations window.mdx (Russian)
[ci skip]

* New translations window.mdx (Chinese Simplified)
[ci skip]

* New translations navbar.json (Japanese)
[ci skip]

* New translations troubleshooting.mdx (Acholi)
[ci skip]

* New translations navbar.json (Chinese Simplified)
[ci skip]

* New translations navbar.json (Russian)
[ci skip]

* New translations navbar.json (Korean)
[ci skip]

* New translations navbar.json (Acholi)
[ci skip]

* New translations events.mdx (Japanese)
[ci skip]

* New translations events.mdx (Korean)
[ci skip]

* New translations events.mdx (Russian)
[ci skip]

* New translations events.mdx (Chinese Simplified)
[ci skip]

* New translations events.mdx (Acholi)
[ci skip]

* New translations howdoesitwork.mdx (Japanese)
[ci skip]

* New translations building.mdx (Korean)
[ci skip]

* New translations development.mdx (Korean)
[ci skip]

* New translations overscroll.mdx (Japanese)
[ci skip]

* New translations overscroll.mdx (Korean)
[ci skip]

* New translations overscroll.mdx (Russian)
[ci skip]

* New translations overscroll.mdx (Chinese Simplified)
[ci skip]

* New translations introduction.mdx (Korean)
[ci skip]

* New translations overscroll.mdx (Acholi)
[ci skip]

* New translations bleeding-edge.mdx (Japanese)
[ci skip]

* New translations bleeding-edge.mdx (Korean)
[ci skip]

* New translations bleeding-edge.mdx (Russian)
[ci skip]

* New translations bleeding-edge.mdx (Chinese Simplified)
[ci skip]

* New translations bleeding-edge.mdx (Acholi)
[ci skip]

* New translations introduction.mdx (Korean)
[ci skip]

* New translations introduction.mdx (Korean)
[ci skip]

* New translations troubleshooting.mdx (Japanese)
[ci skip]

* New translations troubleshooting.mdx (Korean)
[ci skip]

* New translations troubleshooting.mdx (Russian)
[ci skip]

* New translations troubleshooting.mdx (Chinese Simplified)
[ci skip]

* New translations howdoesitwork.mdx (Japanese)
[ci skip]

* New translations troubleshooting.mdx (Acholi)
[ci skip]

* New translations frameless.mdx (Japanese)
[ci skip]

* New translations frameless.mdx (Korean)
[ci skip]

* New translations frameless.mdx (Russian)
[ci skip]

* New translations frameless.mdx (Chinese Simplified)
[ci skip]

* New translations options.mdx (Japanese)
[ci skip]

* New translations options.mdx (Korean)
[ci skip]

* New translations options.mdx (Russian)
[ci skip]

* New translations options.mdx (Chinese Simplified)
[ci skip]

* New translations frameless.mdx (Acholi)
[ci skip]

* New translations options.mdx (Acholi)
[ci skip]

* Fix issues again
2022-09-12 21:56:43 +10:00

159 lines
5.8 KiB
Plaintext

# 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
//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`:
```xml
<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:
<p className="text--center">
<img
src={
require("@site/static/img/troubleshooting/invalid_mac_app.png").default
}
/>
</p>
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:
```go
func (a *App) TestFunc(msg string, args ...interface{}) error {
// Code
}
```
calling this method from the frontend like this will fail:
```js
var msg = "Hello: ";
var args = ["Go", "JS"];
window.go.main.App.TestFunc(msg, ...args)
.then((result) => {
//do things here
})
.catch((error) => {
//handle error
});
```
Workaround:
```js
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](https://github.com/tkrajina/typescriptify-golang-structs#custom-types).
## 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:
```html
<head>
<script src="/wails/ipc.js"></script>
<script src="/wails/runtime.js"></script>
</head>
```
Source: https://github.com/wailsapp/wails/discussions/1512
## I get `too many open files` errors on my Mac when I run `wails dev`
By default, macOS will only allow you to open a maximum of 256 files. This can affect the `wails dev` command.
This limit can be increased by running: `ulimit -n 1024` in the terminal.
FSNotify is [looking to move to Apple's fsevents](https://github.com/fsnotify/fsnotify/issues/11) for Mac.
If this isn't completed soon, we will create our own implementation, tracked [here](https://github.com/wailsapp/wails/issues/1733).
## My Mac app gives me weird compilation errors
A few users have reported seeing compilation errors such as the following:
```shell
# github.com/wailsapp/wails/v2/internal/frontend/desktop/darwin
In file included from ../../pkg/mod/github.com/wailsapp/wails/v2@v2.0.0-beta.44.2/internal/frontend/desktop/darwin/callbacks.go:9:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:12:
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:91:143: error: function does not return NSString
- (NSAttributedString *)localizedAttributedStringForKey:(NSString *)key value:(nullable NSString *)value table:(nullable NSString *)tableName NS_FORMAT_ARGUMENT(1) NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
~~~~~~~~~~~~~~ ^ ~
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:103:48: note: expanded from macro 'NS_FORMAT_ARGUMENT'
#define NS_FORMAT_ARGUMENT(A) __attribute__ ((format_arg(A)))
```
This is *normally* due to a mismatch with the OS version you are running and the version of the XCode Command Line Tools
installed. If you see an error like this, try upgrading your XCode Command Line Tools to the latest version.
Source: https://github.com/wailsapp/wails/issues/1806