5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails 5.1.1 で、テスト環境のときだけ manifest-test.json がないとか言われるときの対処法

Last updated at Posted at 2017-07-25

Rails 5.1.1 でテストを実行するとビューの javascript_pack_tag "application"

ActionView::Template::Error:
  Can't find application.js in public/packs/manifest-test.json. Is webpack still compiling?

とか言われました。

これは config/webpack/paths.yml の次の部分が影響しているっぽいです。

test:
  <<: *default
  manifest: manifest-test.json

なので、ためしに manifest 行を消してやれば通るようになりました。

なお Rails 5.1.2 で rails new すると、この部分を含め config/webpack* 関連がけっこう変わっていたので、
なんかおかしかったら深追いせずに、最新版にするなり rails webpacker:install するなりした方がよさそうです。

(追記) あとでわかったのですが Rails 5.1.2 だからというより webpacker gem1.22.0 の差だとわかりました。つまり、なんかおかしかったら、まずは bundle update webpacker && rails webpacker:install ですね。

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?