gobuffalo / buffalo

Rapid Web Development w/ Go
http://gobuffalo.io
MIT License
8.08k stars 577 forks source link

bug: public/embed.go error missing file dir on executing buffalo dev #2338

Open chapmandu opened 2 years ago

chapmandu commented 2 years ago

Description

Description

Running buffalo dev after creating a new application causes exception.

Expected Behavior

Expect the command to be completed without exit.

Actual Behavior

Terminal output (snippet.. full output further down)

...
# buffet/public
public/embed.go:11:5: embed assets/keep: open public/assets/keep: no such file or directory
github.com/gobuffalo/buffalo-pop/v3/pop/popmw
buffalo: 2022/10/08 10:44:01 === Error! ===
buffalo: 2022/10/08 10:44:01 === exit status 2
...

public dir: image

Full terminal output

``` buffalo: 2022/10/08 10:43:31 === Rebuild on: :start: === buffalo: 2022/10/08 10:43:31 === Running: go build -v -tags development sqlite -o tmp/buffet-build ./cmd/app (PID: 1936645) === golang.org/x/sys/internal/unsafeheader github.com/gobuffalo/buffalo/internal/defaults github.com/rogpeppe/go-internal/semver github.com/gobuffalo/plush/v4/token golang.org/x/net/html/atom github.com/gobuffalo/pop/v6/internal/defaults github.com/gobuffalo/pop/v6/logging github.com/gobuffalo/github_flavored_markdown/internal/shurcooL/sanitized_anchor_name golang.org/x/crypto/pbkdf2 github.com/gobuffalo/plush/v4/lexer github.com/microcosm-cc/bluemonday/css github.com/BurntSushi/toml/internal github.com/gobuffalo/pop/v6/internal/randx github.com/gobuffalo/helpers/hctx github.com/jackc/pgconn/internal/ctxwatch golang.org/x/sys/unix github.com/dustin/go-humanize github.com/gofrs/uuid github.com/monoculum/formam github.com/rogpeppe/go-internal/module github.com/gobuffalo/buffalo/internal/httpx github.com/BurntSushi/toml github.com/gobuffalo/flect github.com/gobuffalo/github_flavored_markdown/internal/russross/blackfriday github.com/gobuffalo/github_flavored_markdown/internal/shurcooL/highlight_diff github.com/rogpeppe/go-internal/modfile github.com/gobuffalo/github_flavored_markdown/internal/shurcooL/highlight_go golang.org/x/net/html github.com/gobuffalo/helpers/content github.com/gobuffalo/helpers/debug github.com/gobuffalo/helpers/encoders github.com/gobuffalo/nulls github.com/gobuffalo/helpers/env github.com/gobuffalo/helpers/escapes github.com/gobuffalo/tags/v3 github.com/gobuffalo/validate/v3 github.com/gobuffalo/helpers/iterators github.com/gobuffalo/flect/name github.com/gobuffalo/helpers/inflections github.com/gobuffalo/helpers/meta github.com/gobuffalo/validate/v3/validators github.com/gobuffalo/plush/v4/ast github.com/gobuffalo/buffalo/binding/decoders github.com/gobuffalo/envy github.com/gobuffalo/buffalo/runtime github.com/gobuffalo/buffalo/servers github.com/gobuffalo/tags/v3/form github.com/gobuffalo/helpers/paths github.com/gobuffalo/buffalo/binding github.com/gobuffalo/events/internal/mapi github.com/gobuffalo/events/internal/safe github.com/gobuffalo/grift/grift github.com/gobuffalo/pop/v6/columns github.com/gobuffalo/helpers/tags github.com/jackc/pgproto3/v2 github.com/gobuffalo/events github.com/gobuffalo/plush/v4/parser github.com/jackc/pgtype github.com/gobuffalo/meta github.com/jackc/pgx/v4/internal/sanitize golang.org/x/sync/errgroup github.com/gobuffalo/helpers/forms ➤ YN0000: ┌ Resolution step github.com/gobuffalo/tags/v3/form/bootstrap github.com/gobuffalo/pop/v6/associations github.com/mattn/go-sqlite3 github.com/mitchellh/go-homedir github.com/felixge/httpsnoop github.com/gorilla/mux ➤ YN0000: ⠙ buffalo@workspace:. github.com/gobuffalo/buffalo/plugins/plugdeps github.com/gorilla/securecookie ➤ YN0000: ⠙ mime-db@npm:1.52.0 github.com/microcosm-cc/bluemonday github.com/gobuffalo/helpers/forms/bootstrap github.com/mattn/go-isatty ➤ YN0000: ⠹ util-deprecate@npm:^1.0.2 golang.org/x/term ➤ YN0000: ⠹ minizlib@npm:^2.1.1 github.com/mattn/go-colorable ➤ YN0000: └ Completed in 0s 412ms ➤ YN0000: ┌ Fetch step ➤ YN0000: ⠸ -------------------------------------------------------------------------------- github.com/unrolled/secure github.com/fatih/color ➤ YN0000: ⠸ ====---------------------------------------------------------------------------- github.com/gobuffalo/refresh/filenotify github.com/nicksnyder/go-i18n/i18n/language ➤ YN0000: ⠼ ======-------------------------------------------------------------------------- ➤ YN0000: ⠴ ====================------------------------------------------------------------ ➤ YN0000: ⠴ ========================-------------------------------------------------------- github.com/gobuffalo/buffalo/worker github.com/gobuffalo/logger ➤ YN0000: ⠦ ==============================-------------------------------------------------- ➤ YN0000: ⠦ =================================----------------------------------------------- ➤ YN0000: ⠧ =====================================------------------------------------------- ➤ YN0000: ⠇ =============================================----------------------------------- ➤ YN0000: ⠇ =================================================------------------------------- ➤ YN0000: ⠇ ===================================================----------------------------- ➤ YN0000: ⠏ ============================================================-------------------- ➤ YN0000: ⠏ =========================================================================------- ➤ YN0000: └ Completed in 0s 693ms ➤ YN0000: ┌ Link step github.com/nicksnyder/go-i18n/i18n github.com/gobuffalo/fizz github.com/gobuffalo/buffalo/render ➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental ➤ YN0000: └ Completed in 0s 212ms github.com/gobuffalo/fizz/translators ➤ YN0000: Done with warnings in 1s 546ms github.com/jackc/pgx/v4 github.com/jackc/pgx/v4/stdlib [LiveReloadPlugin] Live Reload listening on port 35729 assets by path *.eot 363 KiB asset 9bbb245e67a133f6e486d8d2545e14a5.eot 198 KiB [emitted] (auxiliary name: application) asset 23f19bb08961f37aaf692ff943823453.eot 131 KiB [emitted] (auxiliary name: application) asset 77206a6bb316fa0aded5083cc57f92b9.eot 33.2 KiB [emitted] (auxiliary name: application) assets by info 5.31 MiB [immutable] asset application.0a65f1ca34af597f4655.css 3.54 MiB [emitted] [immutable] (name: application) asset application.d9a3596ccf416fc73a97.js 1.77 MiB [emitted] [immutable] (name: application) assets by path images/ 65.5 KiB asset images/logo.svg 64.4 KiB [emitted] [from: assets/images/logo.svg] [copied] asset images/favicon.ico 1.12 KiB [emitted] [from: assets/images/favicon.ico] [copied] asset manifest.json 397 bytes [emitted] Entrypoint application 5.31 MiB (363 KiB) = application.0a65f1ca34af597f4655.css 3.54 MiB application.d9a3596ccf416fc73a97.js 1.77 MiB 3 auxiliary assets orphan modules 4.24 MiB (javascript) 776 bytes (runtime) [orphan] 23 modules runtime modules 495 bytes 2 modules cacheable modules 1.7 MiB (javascript) 3.54 MiB (css/mini-extract) javascript modules 1.7 MiB modules by path ./ 1.42 MiB modules by path ./.yarn/ 1.42 MiB 4 modules modules by path ./assets/ 260 bytes ./assets/css/application.scss 50 bytes [built] [code generated] ./assets/js/application.js 210 bytes [built] [code generated] modules by path ../../../.yarn/berry/cache/jquery-npm-3.6.1-6f29087f48-8.zip/node_modules/jquery/dist/*.js 284 KiB ./.yarn/__virtual__/expose-loader-virtual-976c7fc395/4/.yarn/berry/cache/expose-loader-npm-3.1.0-ecdb5cf554-8.zip/node_modules/expose-loader/dist/cjs.js?exposes=$,jQuery!../../../.yarn/berry/cache/jquery-npm-3.6.1-6f29087f48-8.zip/node_modules/jquery/dist/jquery-exposed.js 1010 bytes [built] [code generated] ../../../.yarn/berry/cache/jquery-npm-3.6.1-6f29087f48-8.zip/node_modules/jquery/dist/jquery.js 283 KiB [built] [code generated] css modules 3.54 MiB css ./.yarn/__virtual__/css-loader-virtual-353782cc19/4/.yarn/berry/cache/css-loader-npm-3.5.3-0f886851e6-8.zip/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./.yarn/unplugged/@fortawesome-fontawesome-free-npm-5.15.4-7752dc20e0/node_modules/@fortawesome/fontawesome-free/css/all.min.css 3.31 MiB [built] [code generated] css ./.yarn/__virtual__/css-loader-virtual-353782cc19/4/.yarn/berry/cache/css-loader-npm-3.5.3-0f886851e6-8.zip/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!../../../.yarn/berry/cache/postcss-loader-npm-3.0.0-f4ab99b685-8.zip/node_modules/postcss-loader/src/index.js??ruleSet[1].rules[0].use[2]!./.yarn/__virtual__/sass-loader-virtual-61227fe8a1/4/.yarn/berry/cache/sass-loader-npm-10.2.1-eb918cbb8a-8.zip/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[0].use[3]!./assets/css/application.scss 232 KiB [built] [code generated] webpack 5.65.0 compiled successfully in 6111 ms assets by status 5.73 MiB [cached] 7 assets asset manifest.json 397 bytes [emitted] Entrypoint application 5.31 MiB (363 KiB) = application.0a65f1ca34af597f4655.css 3.54 MiB application.d9a3596ccf416fc73a97.js 1.77 MiB 3 auxiliary assets cached modules 1.7 MiB (javascript) 3.54 MiB (css/mini-extract) 495 bytes (runtime) [cached] 12 modules webpack 5.65.0 compiled successfully in 20 ms github.com/gobuffalo/pop/v6 buffet/models github.com/gobuffalo/buffalo buffet/locales buffet/public buffet/templates github.com/gobuffalo/buffalo-pop/v3/pop github.com/gobuffalo/mw-csrf github.com/gobuffalo/mw-forcessl github.com/gobuffalo/mw-i18n/v2 github.com/gobuffalo/mw-paramlogger # buffet/public public/embed.go:11:5: embed assets/keep: open public/assets/keep: no such file or directory github.com/gobuffalo/buffalo-pop/v3/pop/popmw buffalo: 2022/10/08 10:44:01 === Error! === buffalo: 2022/10/08 10:44:01 === exit status 2 golang.org/x/sys/internal/unsafeheader github.com/gobuffalo/buffalo/internal/defaults github.com/rogpeppe/go-internal/semver github.com/gobuffalo/plush/v4/token golang.org/x/net/html/atom github.com/gobuffalo/pop/v6/internal/defaults github.com/gobuffalo/pop/v6/logging github.com/gobuffalo/github_flavored_markdown/internal/shurcooL/sanitized_anchor_name golang.org/x/crypto/pbkdf2 github.com/gobuffalo/plush/v4/lexer github.com/microcosm-cc/bluemonday/css github.com/BurntSushi/toml/internal github.com/gobuffalo/pop/v6/internal/randx github.com/gobuffalo/helpers/hctx github.com/jackc/pgconn/internal/ctxwatch golang.org/x/sys/unix github.com/dustin/go-humanize github.com/gofrs/uuid github.com/monoculum/formam github.com/rogpeppe/go-internal/module github.com/gobuffalo/buffalo/internal/httpx github.com/BurntSushi/toml github.com/gobuffalo/flect github.com/gobuffalo/github_flavored_markdown/internal/russross/blackfriday github.com/gobuffalo/github_flavored_markdown/internal/shurcooL/highlight_diff github.com/rogpeppe/go-internal/modfile github.com/gobuffalo/github_flavored_markdown/internal/shurcooL/highlight_go golang.org/x/net/html github.com/gobuffalo/helpers/content github.com/gobuffalo/helpers/debug github.com/gobuffalo/helpers/encoders github.com/gobuffalo/nulls github.com/gobuffalo/helpers/env github.com/gobuffalo/helpers/escapes github.com/gobuffalo/tags/v3 github.com/gobuffalo/validate/v3 github.com/gobuffalo/helpers/iterators github.com/gobuffalo/flect/name github.com/gobuffalo/helpers/inflections github.com/gobuffalo/helpers/meta github.com/gobuffalo/validate/v3/validators github.com/gobuffalo/plush/v4/ast github.com/gobuffalo/buffalo/binding/decoders github.com/gobuffalo/envy github.com/gobuffalo/buffalo/runtime github.com/gobuffalo/buffalo/servers github.com/gobuffalo/tags/v3/form github.com/gobuffalo/helpers/paths github.com/gobuffalo/buffalo/binding github.com/gobuffalo/events/internal/mapi github.com/gobuffalo/events/internal/safe github.com/gobuffalo/grift/grift github.com/gobuffalo/pop/v6/columns github.com/gobuffalo/helpers/tags github.com/jackc/pgproto3/v2 github.com/gobuffalo/events github.com/gobuffalo/plush/v4/parser github.com/jackc/pgtype github.com/gobuffalo/meta github.com/jackc/pgx/v4/internal/sanitize golang.org/x/sync/errgroup github.com/gobuffalo/helpers/forms github.com/gobuffalo/tags/v3/form/bootstrap github.com/gobuffalo/pop/v6/associations github.com/mattn/go-sqlite3 github.com/mitchellh/go-homedir github.com/felixge/httpsnoop github.com/gorilla/mux github.com/gobuffalo/buffalo/plugins/plugdeps github.com/gorilla/securecookie github.com/gobuffalo/github_flavored_markdown/internal/shurcooL/octicon github.com/microcosm-cc/bluemonday github.com/gobuffalo/helpers/forms/bootstrap github.com/mattn/go-isatty github.com/sirupsen/logrus golang.org/x/term github.com/fsnotify/fsnotify github.com/gorilla/sessions github.com/mattn/go-colorable github.com/unrolled/secure github.com/fatih/color github.com/gorilla/handlers github.com/gobuffalo/refresh/filenotify github.com/nicksnyder/go-i18n/i18n/language github.com/jackc/pgconn github.com/pelletier/go-toml github.com/gobuffalo/refresh/refresh github.com/gobuffalo/buffalo/worker github.com/gobuffalo/logger github.com/gobuffalo/buffalo/plugins github.com/gobuffalo/github_flavored_markdown github.com/nicksnyder/go-i18n/i18n/translation github.com/gobuffalo/refresh/refresh/web github.com/gobuffalo/helpers/text github.com/gobuffalo/helpers github.com/jackc/pgconn/stmtcache github.com/gobuffalo/plush/v4 github.com/nicksnyder/go-i18n/i18n/bundle github.com/nicksnyder/go-i18n/i18n github.com/gobuffalo/fizz github.com/gobuffalo/buffalo/render github.com/gobuffalo/fizz/translators github.com/jackc/pgx/v4 github.com/jackc/pgx/v4/stdlib github.com/gobuffalo/pop/v6 buffet/models github.com/gobuffalo/buffalo buffet/locales buffet/public buffet/templates github.com/gobuffalo/buffalo-pop/v3/pop github.com/gobuffalo/mw-csrf github.com/gobuffalo/mw-forcessl github.com/gobuffalo/mw-i18n/v2 github.com/gobuffalo/mw-paramlogger # buffet/public public/embed.go:11:5: embed assets/keep: open public/assets/keep: no such file or directory github.com/gobuffalo/buffalo-pop/v3/pop/popmw === ```

To Reproduce

buffalo new buffet --db-type sqlite3
buffalo dev

Executing buffalo dev a second time will complete successfully, though it's not ideal.

Additional Context

OS: Linux Mint 20.3

Details

``` -> Go: Checking installation ✓ The `go` executable was found on your system at: /usr/local/go/bin/go -> Go: Checking minimum version requirements ✓ Your version of Go, 1.18.4, meets the minimum requirements. -> Go: Checking Package Management ✓ You are using Go Modules (`go`) for package management. -> Go: Checking PATH ✓ Your PATH contains /home/adam/go/bin. -> Node: Checking installation ✓ The `node` executable was found on your system at: /usr/local/bin/node -> Node: Checking minimum version requirements ✓ Your version of Node, v16.17.1, meets the minimum requirements. -> NPM: Checking installation ✓ The `npm` executable was found on your system at: /usr/local/bin/npm -> NPM: Checking minimum version requirements ✓ Your version of NPM, 8.19.2, meets the minimum requirements. -> Yarn: Checking installation ✓ The `yarnpkg` executable was found on your system at: /usr/local/bin/yarnpkg -> Yarn: Checking minimum version requirements ✓ Your version of Yarn, 3.2.4, meets the minimum requirements. -> PostgreSQL: Checking installation ✘ The `postgres` executable could not be found on your system. For help setting up your Postgres environment please follow the instructions for you platform at: https://www.postgresql.org/download/ -> MySQL: Checking installation ✓ The `mysql` executable was found on your system at: /usr/bin/mysql -> MySQL: Checking minimum version requirements ✓ Your version of MySQL, 8.0.30, meets the minimum requirements. -> SQLite3: Checking installation ✓ The `sqlite3` executable was found on your system at: /usr/bin/sqlite3 -> SQLite3: Checking minimum version requirements ✓ Your version of SQLite3, 3.31.1, meets the minimum requirements. -> Cockroach: Checking installation ✘ The `cockroach` executable could not be found on your system. For help setting up your Cockroach environment please follow the instructions for you platform at: https://www.cockroachlabs.com/docs/stable/ -> Buffalo (CLI): Checking installation ✓ The `buffalo` executable was found on your system at: /usr/local/bin/buffalo -> Buffalo (CLI): Checking minimum version requirements ✓ Your version of Buffalo (CLI), v0.18.8, meets the minimum requirements. -> Buffalo: Application Details Pwd /home/adam/code/goapps/buffet Root /home/adam/code/goapps/buffet GoPath /home/adam/go PackagePkg buffet ActionsPkg buffet/actions ModelsPkg buffet/models GriftsPkg buffet/grifts WithModules true Name buffet Bin bin/buffet VCS git WithPop true WithSQLite true WithDep false WithWebpack true WithNodeJs true WithYarn true WithDocker true WithGrifts true AsWeb true AsAPI false InApp true PackageJSON {map[build:webpack --mode production --progress dev:webpack --watch]} -> Buffalo: config/buffalo-app.toml name = "buffet" bin = "bin/buffet" vcs = "git" with_pop = true with_sqlite = true with_dep = false with_webpack = true with_nodejs = true with_yarn = true with_docker = true with_grifts = true as_web = true as_api = false -> Buffalo: config/buffalo-plugins.toml [[plugin]] binary = "buffalo-pop" go_get = "github.com/gobuffalo/buffalo-pop/v3@latest" tags = ["sqlite"] -> Buffalo: go.mod module buffet go 1.18 require ( github.com/gobuffalo/buffalo v1.0.1 github.com/gobuffalo/buffalo-pop/v3 v3.0.6 github.com/gobuffalo/envy v1.10.2 github.com/gobuffalo/grift v1.5.2 github.com/gobuffalo/mw-csrf v1.0.1 github.com/gobuffalo/mw-forcessl v1.0.1 github.com/gobuffalo/mw-i18n/v2 v2.0.2 github.com/gobuffalo/mw-paramlogger v1.0.1 github.com/gobuffalo/pop/v6 v6.0.8 github.com/gobuffalo/suite/v4 v4.0.3 github.com/unrolled/secure v1.13.0 ) require ( github.com/BurntSushi/toml v1.2.0 // indirect github.com/Masterminds/semver/v3 v3.1.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dustin/go-humanize v1.0.0 // indirect github.com/fatih/color v1.13.0 // indirect github.com/fatih/structs v1.1.0 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/go-sql-driver/mysql v1.6.0 // indirect github.com/gobuffalo/events v1.4.3 // indirect github.com/gobuffalo/fizz v1.14.4 // indirect github.com/gobuffalo/flect v0.3.0 // indirect github.com/gobuffalo/github_flavored_markdown v1.1.3 // indirect github.com/gobuffalo/helpers v0.6.7 // indirect github.com/gobuffalo/httptest v1.5.2 // indirect github.com/gobuffalo/logger v1.0.7 // indirect github.com/gobuffalo/meta v0.3.3 // indirect github.com/gobuffalo/nulls v0.4.2 // indirect github.com/gobuffalo/plush/v4 v4.1.16 // indirect github.com/gobuffalo/refresh v1.13.2 // indirect github.com/gobuffalo/tags/v3 v3.1.4 // indirect github.com/gobuffalo/validate/v3 v3.3.3 // indirect github.com/gofrs/uuid v4.3.0+incompatible // indirect github.com/gorilla/css v1.0.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/securecookie v1.1.1 // indirect github.com/gorilla/sessions v1.2.1 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.13.0 // indirect github.com/jackc/pgio v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgproto3/v2 v2.3.1 // indirect github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect github.com/jackc/pgtype v1.12.0 // indirect github.com/jackc/pgx/v4 v4.17.2 // indirect github.com/jmoiron/sqlx v1.3.5 // indirect github.com/joho/godotenv v1.4.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/luna-duclos/instrumentedsql v1.1.3 // indirect github.com/mattn/go-colorable v0.1.9 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/mattn/go-sqlite3 v1.14.15 // indirect github.com/microcosm-cc/bluemonday v1.0.20 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/monoculum/formam v3.5.5+incompatible // indirect github.com/nicksnyder/go-i18n v1.10.1 // indirect github.com/pelletier/go-toml v1.2.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/sergi/go-diff v1.2.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect github.com/spf13/cobra v1.5.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/testify v1.8.0 // indirect golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect golang.org/x/net v0.0.0-20221002022538-bcab6841153b // indirect golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0 // indirect golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect golang.org/x/text v0.3.7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) ```
sio4 commented 2 years ago

(I added <details> tag in your original post to make it short and can see the details when it is required)

Thanks for the report.

I think the issue is a side effect of the behavior of Webpack and the workaround for embed. The missing file keep is a kind of placeholder to make embed runs without error even if the directory is initially empty, but I found the file was removed after Webpack runs. (As far as I remember, this behavior is somewhat different than before.) The sequence was maybe,

  1. buffalo dev executed Webpack and go build
  2. go build detected file list for assets (including keep)
  3. Webpack removes all existing files including keep
  4. go build tried to read the file but it was just removed by webpack

As described above, it seems like Webpack removes all pre-existing files when it dumps its new files into the assets directory. The next time, the file keep is not an issue anymore, but this issue could happen again because the other asset files could be in the same situation.

I will check it in more detail.

sio4 commented 2 years ago

Found the root cause:

https://github.com/gobuffalo/cli/blob/0e3b085227c7aa963dee240f249ee136f62dd836/internal/genny/assets/webpack/templates/webpack.config.js.tmpl#L93-L97

was introduced to fix the other issue by https://github.com/gobuffalo/cli/pull/71 and it made Webpack removes all existing files under the target destination directory by default. (https://webpack.js.org/guides/output-management/#cleaning-up-the-dist-folder)

Since this issue happens randomly, just ignoring the error could be one option for now, or removing the config clean: true from the webpack.config.js could be another option if the issue happens frequently.

FYI, buffalo build command has an option --clean-assets for cleaning the asset directory when it builds a binary.

I will keep this issue open and will revisit again to find a better solution.