0
0

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 3 years have passed since last update.

Railsアップデートにsproketsのエラーが出て起動できない

Posted at

環境

  • ruby 2.6.1
  • rails 5.2.2 -> 5.2.6

railsアップデート手順

  1. Gemfileのrailsの箇所をgem 'rails', '5.2.6'に書き換え
  2. bundle update --conservative railsを実行
  3. エラーが出たら都度そのgemをrailsの後に追加していく
  4. rails app:updateを実行
  5. 更新内容を確認しながら適用していく

発生したエラー

rails sでページを確認すると下記エラーが発生

fest file in `app/assets/config/manifest.js` (Sprockets::Railtie::ManifestNeededError)
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

For more information see: https://github.com/rails/sprockets/blob/070fc01947c111d35bb4c836e9bb71962a8e0595/UPGRADING.md#manifestjs

言われるがままmanifest.jsを追加するが下記エラーが発生

cannot load such file -- sassc

sasscのgem追加やmanifest.js周りの設定を書き換えるも解消できず
(railsの中にengineも使っていて、そちらのsasscのコンパイルがうまく行っていないような挙動だった)

修正方法

sprocketsの変更履歴を調べると4系から必要な対応だったため、バージョンを3系に固定しました(根本解決ではないので情報求む)

  1. Gemfileにgem 'sprockets', <~ '3.7.2'を追加
  2. bunfle update --conservative sprocketsを実行
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?