问题
I followed stack overfolw's answer
to add adminlte in my rails app
it also says to add
//= require adminlte
in application.js
it works fine on local system but now when I am trying to deploy to digital ocean droplet it gives error
Sprockets::FileNotFound: couldn't find file 'adminlte' with type 'application/javascript'
My gemfile(I removed all gems except relavent) to clear the adminlte issue
source 'https://rubygems.org'
gem 'bundler', '>= 1.8.4'
gem 'pnotify-rails'
source 'https://rails-assets.org' do
gem 'rails-assets-adminlte', '2.3.3'
end
end
I normal cases we write
source 'https://rubygems.org'
gem 'pnotify-rail'
and in application.js
//= require pnotify
and don't include any file like pnotify.js manully
But in this case I instead used
source 'https://rails-assets.org' do
gem 'rails-assets-adminlte', '2.3.3'
end
and for this
//= require adminlte
causing issue
回答1:
From What I understand, you do not have a file named adminlte
in your javascript folder.
Your app/assets/javascripts/
must have all the files that you want to require in your application.js
So if you have required adminlte
, you must also have a file with the same name in your javascripts folder.
I see that you are using a theme, you might want to consider copying all the javascript and css files to the respective folders. If you have a folder to require, you could use // require_tree ./adminlte
which requires all the files in that folder.
I hope this helps :)
回答2:
I had the same problem, having to import adminlte
on some servers and AdminLTE
on others.
Just use rails-assets-admin-lte
instead of rails-assets-adminlte
(they're based on the same code) and import admin-lte
instead of adminlte
in your CSS and JS application files.
来源:https://stackoverflow.com/questions/36797315/sprocketsfilenotfound-couldnt-find-file-adminlte-with-type-application-ja