LoginSignup
19
8

More than 3 years have passed since last update.

【rails sできない解決法】rails aborted! Sprockets::Railtie::ManifestNeededError: Expected to find a manifest file

Last updated at Posted at 2019-10-27

解決策だけ書いたページです。解説しません。

ターミナルにこんな感じのエラーがでた人向けです。

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/okakaori/projects/todo_app/memo_app/config/environment.rb:5:in `<top (required)>'
/Users/okakaori/projects/todo_app/memo_app/bin/rails:9:in `require'
/Users/okakaori/projects/todo_app/memo_app/bin/rails:9:in `<top (required)>'
/Users/okakaori/projects/todo_app/memo_app/bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:create => db:load_config => environment
(See full trace by running task with --trace)
okakaorinoAir:memo_app okakaori$ rake db:creat
rake aborted!
Don't know how to build task 'db:creat' (See the list of available tasks with `rake --tasks`)
Did you mean?  db:create

(See full trace by running task with --trace)

解決法

①不足した「manifest.js」を作る

app/assets/config/manifest.js
上記のフォルダに「manifest.js」を作って入れる。
app/assets/配下に「config」がない場合は自分で作る。

②manifest.jsに不足した記述を書く

①で作ったファイルに下記を記入

manifest.js
  //= link_tree ../images
  //= link_directory ../javascripts .js
  //= link_directory ../stylesheets .css

③rails s

これで見れるはず。
localhost:3000にて「Sprockets::Railtie::ManifestNeededError:」で見れない場合は
①②が原因でそもそもdbが作れてない可能性があるので、
下記のくだりをもう一通りやってみてください。

[例のアレ]
bundle exec rake db:create
 ↓
bundle exec rake db:migrate

参考記事

DB作成時の「Sprockets::Railtie::ManifestNeededError:」の解決方法
https://qiita.com/kota-es/items/afdc1fb743408f4a5210

19
8
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
19
8