Why does Rails fails to boot with “Expected to find a manifest file in `app/assets/config/manifest.js` (Sprockets::Railtie::ManifestNeededError)”?

徘徊边缘 提交于 2020-01-12 02:52:08

问题


After bundle update my Rails app fails to boot with:

Expected to find a manifest file in `app/assets/config/manifest.js` (Sprockets::Railtie::ManifestNeededError)

回答1:


They've changed things with the latest version of sprockets. This error comes up because you don't have a manifest.js created. You need to create one, and add in a few lines to make sure things are working.

Easy Steps To Solve the Problem:

  1. Create the manifest.js file

    $ mkdir -p app/assets/config

    $ touch app/assets/config/manifest.js

  2. Then copy and paste the following into the manifest.js file you just created:

    //= link_tree ../images
    //= link_directory ../javascripts .js
    //= link_directory ../stylesheets .css
    
  3. If you have a precompile array in your app/config/ folder (see below for an example) e.g. app/config/production.rb then perhaps you should move them over to your manifest.js

    config.assets.precompile = ["admin.js", "admin.css"]

Source: Thanks to Richard Schneeman's blog - see here for more information..




回答2:


A new major version of sprockets was recently released which is not compatible with the previous version.

Either perform the steps needed to upgrade or pin to version 3.x in Gemfile

gem 'sprockets', '~>3.0'



回答3:


As suggested by link http://www.redmine.org/boards/2/topics/58169, it is a known issue. See #32223 and sprockets 4.0.0 breaks Redmine 3.4.11 with Ruby <2.5.0.

I just reproduced this issue with redmine 3.4.4, but found everything is ok with Redmine 3.4.12.

wget http://www.redmine.org/releases/redmine-3.4.12.tar.gz



来源:https://stackoverflow.com/questions/58339607/why-does-rails-fails-to-boot-with-expected-to-find-a-manifest-file-in-app-asse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!