LoginSignup
2
0

More than 3 years have passed since last update.

rails install:webpackerができない件について

Last updated at Posted at 2019-12-03

環境

  • 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

を追加

無事にrails install:webpackerが通りました。

参考

2
0
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
2
0