wails icon indicating copy to clipboard operation
wails copied to clipboard

no `index.html` could be found in your Assets fs.FS

Open precisionpete opened this issue 1 year ago • 10 comments

Description

I have an app that used to work but now I am getting noindex.html could be found in your Assets fs.FS, please make sure the embedded directory '.' is correct and contains your assets.

wails dev works fine but wails build produces the error. I assume this means its not something in my code?

To Reproduce

Using my specific app. Run:

wails dev --> it works

wails build build/bin/myapp

2023/11/10 10:12:01 no index.html could be found in your Assets fs.FS, please make sure the embedded directory '.' is correct and contains your assets

It works fine with the example app.

Expected behaviour

the build should work

Screenshots

No response

Attempted Fixes

I tried changing the order of embeds, same problem.

I tested on macOS & Windows and it fails there too.

System Details

Wails Doctor          
                                

                                                                                                                                 
# Wails
Version         | v2.6.0
Package Manager | apt   

# System
┌───────────────────────────┐
| OS           | Linux Mint |
| Version      | 21.2       |
| ID           | linuxmint  |
| Go Version   | go1.21.1   |
| Platform     | linux      |
| Architecture | amd64      |
└───────────────────────────┘

# Dependencies
┌──────────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version                 |
| *docker    | docker.io             | Installed | 24.0.5-0ubuntu1~22.04.1 |
| gcc        | build-essential       | Installed | 12.9ubuntu3             |
| libgtk-3   | libgtk-3-dev          | Installed | 3.24.33-1ubuntu2        |
| libwebkit  | libwebkit2gtk-4.0-dev | Installed | 2.42.1-0ubuntu0.22.04.1 |
| npm        | npm                   | Installed | 10.1.0                  |
| *nsis      | nsis                  | Installed | v3.08-2                 |
| pkg-config | pkg-config            | Installed | 0.29.2-1ubuntu3         |
└──────────────────────── * - Optional Dependency ─────────────────────────┘

# Diagnosis
 SUCCESS  Your system is ready for Wails development!

Additional context

I'm sure it has something to do with the build timing. I am looking for suggestions for debugging at this point.

Interestingly, Wails Dr identifies Go 1.21.1 but I am using Go 1.21.4. Where is it getting this from? I have had a few strange transient problems similar to this...

precisionpete avatar Nov 10 '23 15:11 precisionpete

I think I solved it. I had moved the App.go code into a separate package to avoid having to make calls into main. I think this messed up the go embedding. When I returned it to the main package, the problem stopped. I suspect it worked in wails dev because of the asset handler doing the job of the embedding.

I need to go back to the books about how to get stuff in the main package accessible from elsewhere.

precisionpete avatar Nov 10 '23 18:11 precisionpete

You can move things around how you want, just update the embed path (has to be a subdirectory of the current). You can even just package the assets in a different package and export if you like.

leaanthony avatar Nov 10 '23 22:11 leaanthony

Hello, I want to call other wails programs, such as https://github.com/yt-dlp/yt-dlp/releases, within the built unix application, but after the build is complete, I can't find the unix file, image image @leaanthony Have you ever tried this operation before? Or do you have any solution? by looking at the size of the wails file, it seems that the unix file has been packaged into the application image

sgx-wb avatar Nov 14 '23 11:11 sgx-wb

@sgx-wb Can you show your main.go file where the embeds are defined? It also looks like you're jumping into an unrelated thread, can you join the discord or create your own issue?

PylotLight avatar Nov 14 '23 11:11 PylotLight

@sgx-wb Can you show your main.go file where the embeds are defined?

@PylotLight I didn't modify main.go. I just modified vite.config.js and added the static folder. image image

sgx-wb avatar Nov 14 '23 12:11 sgx-wb

@sgx-wb have a go at //go:embed frontend/dist frontend/dist/test instead?

PylotLight avatar Nov 14 '23 12:11 PylotLight

@sgx-wb have a go at //go:embed frontend/dist frontend/dist/test instead?

@PylotLight https://github.com/wailsapp/wails/issues/3055 I created a new question.

sgx-wb avatar Nov 14 '23 12:11 sgx-wb

I am getting this issue, however my app.go is inside of package main, I am using ReactJs

When running wails dev it works however wails build does not work I get the error: no index.html could be found in your Assets fs.FS, please make sure the embedded directory 'frontend/dist' is correct and contains your assets

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

fiendclub avatar Jan 30 '24 14:01 fiendclub

If you change where your assets are built to, then you'll need to change your //go:embed line to point to the right place

leaanthony avatar Jan 31 '24 06:01 leaanthony

wails build command does not seem to compile the UI any longer? image

mega-rds avatar May 29 '24 07:05 mega-rds