環境
- rails 5.2.3
- ruby 2.6.3
- yarn 1.19.2
エラー内容
railsでvue.jsを追加するために、rails install:webpackerをしようとしたところ
rails aborted!
Sprockets::Railtie::ManifestNeededError: Expected to find a manifest file in `app/assets/config/manifest.js`
But did not, please create this file and use it to link any assets that need
to be rendered by your app:
Example:
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
and restart your server
/Users/user/railsProjects/vuejs-on-rails/config/environment.rb:5:in `<main>'
/Users/user/railsProjects/vuejs-on-rails/bin/rails:9:in `<top (required)>'
/Users/user/railsProjects/vuejs-on-rails/bin/spring:15:in `require'
/Users/user/railsProjects/vuejs-on-rails/bin/spring:15:in `<top (required)>'
./bin/rails:3:in `load'
./bin/rails:3:in `<main>'
Tasks: TOP => app:template => environment
(See full trace by running task with --trace)
このようなエラーがでました。
対応
調べたところ、【Rails】rails webpacker:install に失敗する場合の対処法にたどり着き、書いてある通りにconfigにwebpacker.ymlを追加したところ、エラーが変わりませんでした😇
その後、yarnのupgradeをしても変わりませんでした😇
下記のエラーを確認
Expected to find a manifest file in `app/assets/config/manifest.js`
app/assets/config/manifest.jsに
app/assets/config/manifest.js
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
を追加