ActionView::Template::Error (couldn't find file 'jquery.ui.datepicker'
(in /home/raimat/webapps/keita/gems/bundler/gems/active_admin-2ae0a9e09bf9/app/assets/javascripts/active_admin/base.js.coffee:2)):
7: <%= stylesheet_link_tag params[:controller] %>
8: <link rel='stylesheet' href='/assets/typicons.min.css'/>
9:
10: <%= javascript_include_tag "application" %>
11: <%= javascript_include_tag 'ckeditor/ckeditor.js' %>
12:
13:
app/views/layouts/application.html.erb:10:in `_app_views_layouts_application_html_erb__42414357695359850_50936120'
app/controllers/home_controller.rb:15:in `index'
This only occurs when I try to deploy my app at webfaction (Both Production and development). I've tried it on two different local machines, and it goes as smooth as it should.
Edit: I removed Gemfile.lock on my local machine, and now I get this error there as well.
Tried the solutions found at rails active admin deployment : couldn't find file 'jquery-ui' but I still stand with the bug.
I use Rails 4.0.2
ActiveAdmin at master branch
I need jquery-rails > ~> 3.1.0 for another gem
Tried adding gem jquery-rails-ui, but still nothing..
Ideas?
I was running into the same problem. Noticed there was an upgrade to jquery-ui-rails a couple of days ago (July 3, 2014) so I downgraded to the previous version and that fixed my problems
In gemfile
gem 'jquery-ui-rails', '~> 4.2.1'
In application.js
//= require jquery-ui
Related
I want to use bootstrap in my project. My operating system is Windows, Ruby version is 1.9.3, Rails version 4.0.4.
I try to bundle one gem every time because there is dependence in some gem when I execute bundle install.
bootstrap-sass (2.3.2.0)
sass (3.3.5, 3.2.19)
sass-rails (4.0.2)
sprockets (2.12.0, 2.11.0)
Now, I add //= require bootstrap into application.js and add #import "bootstrap" into application.css.scss. But when I start server, I got Load Error in *Controller#home:
cannot load such file -- sass (in D:/first_app/app/assets/style sheets / application.css.scss
Extracted source (around line #5):
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
Rails.root: D:/rails_projects/first_app
Any advice?
Did you make sure that you also removed the sprockets //= require directive in your application.css.scss file?
Also, make sure all your gem versions are aligned. According to this rubygems page, version 2.3.2 of boostrap-rails requires version 3.1 for the saas gem. Running bundle install should also notify you of any gem version mismatches in your Gemfile.
Finally, if you're using Rails 4, why are you using an older version of bootstrap-rails? The latest stable version of bootstrap-rails is 3.1.1.0 (as of Feb 13, 2014).
I just created an empty application and only generated a StaticPages controller with home, help, about, and contact options, but when I access localhost:3000/static_pages/home, I get an error:
ExecJS::RuntimeError in Static_pages#home
Showing [...]views/layouts/application.html.erb where line #6 raised:
(in [...]/app/assets/javascripts/static_pages.js.coffee) Extracted source (around line #6):
3: <head>
4: <title>TodolistApp</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %> 8: </head> 9: <body> Rails.root: [..]
Application Trace | Framework Trace | Full Trace app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__694989846_43803828'
I've looked at a few stackoverflow articles on this same problem, and some recommended installing Node.js, which I have done, but it hasn't done anything. Just to be clear, I have not added any code to any of the static pages views, nor have I added any javascript anywhere.
Also, something interesting is that if I take out line 4 ( <%= javascript_include_tag "application" %>) there is no error. But I assume that if I take this out, the I can't add javascript.
I'd appreciate any help, thanks!
Try to use "gem 'therubyracer'" in your Gemfile, with installed "therubyracer_for_windows"
I did the following (windows 8 64x):
1. Download gem + dll from https://github.com/hiranpeiris/therubyracer_for_windows
2. install this gem (gem instal ...) and move dll-files to "ruby\bin"
3. restart server (rails s, optionally)
4. Then "bundle install" with "gem 'therubyracer'" in my Gemfile works well
Example:
"Using sqlite3 (1.3.7)
Using therubyracer (0.11.0beta1)
Using uglifier (1.3.0)
Using webrat (0.7.1)
Your bundle is complete! Use bundle show [gemname] to see where a bundled gem
is installed."
Add this to your gemfile
gem 'therubyracer', :platform => :ruby
gem 'execjs'
Try this,it might works for you. I got somewhat similar error,i resolved using this.
I have installed rails 3.1 with apache2 and passenger on ubuntu 10.04. using ruby 1.9.2 with RVM.
When I load the application in browser in production (development version works fine on my machine), it does not work.
My Production Error Log is:
Started GET "/articles" for 117.230.75.50 at 2011-09-12 13:51:34 +0000
Processing by ArticlesController#index as HTML
Rendered articles/index.html.erb within layouts/application (56.4ms)
Completed 500 Internal Server Error in 126ms
ActionView::Template::Error (application.css isn't precompiled):
2: <html>
3: <head>
4: <title>Youexpress</title>
5: <%= stylesheet_link_tag "application" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__385712067674585148_29380260'
app/controllers/articles_controller.rb:7:in `index'
But, when I remove the link_tags in app/views/layouts/application.html.erb like this, the application works fine in production mode.
<!DOCTYPE html>
<html>
<head>
<title>Youexpress</title>
</head>
<body>
<%= yield %>
</body>
</html>
How do I get Around this? When I do bundle exec rake assets:precompile I get the following error:
rake aborted!
no such file to load -- uglifier
(in /home/username/youexpress/vendor/bundle/ruby/1.9.1/gems/jquery-rails-1.0.14/vendor/assets/javascripts/jquery-ui.min.js)
Note: In the above error it shows ruby/1.9.1 not 1.9.2 ( I've installed 1.9.2 )
Please help with my situation.
Thanks
I've found the answer myself, The reason for the error is rails app needs javascript runtime for certain features of sass, coffeescript and uglifier to work.
There are many ways to solve this, by installing javascript runtimes like nodejs
But, the solution I went with, and perhaps the easiest one is, adding gem 'therubyracer' to my Gemfile and then running bundle install
Excerpt from my Gemfile is below
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'therubyracer'
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
adding therubyracer also fixes rake assets:precompile
Hope this helps. I've spent days searching for this solution.
I've created a clean and simple Rails 3.1 application called demo1. It contains two controllers - hello and goodbye. I get the following error when I try to load http://localhost:3000/say/hello:
ActionView::Template::Error (
(in /home/me/dev/ruby/demo1/app/assets/javascripts/say.js.coffee)):
3: <head>
4: <title>Demo1</title>
5: <%= stylesheet_link_tag "application" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
9: <body>
app/views/layouts/application.html.erb:6:in
`_app_views_layouts_application_html_erb___558576499_89622220'
The problematic line of application.html.erb is:
<%= javascript_include_tag "application" %>
When I created the application using Rails 3.0 this particular line was:
<%= javascript_include_tag :defaults %>
And this worked fine. In fact, when I change the application.html.erb to use :defaults everything works, but I want to use the new features of Rails 3.1.
I can't seem to turn up anything on Google around this, I guess because Rails 3.1 has just been released.
By the way, I'm following the first chapter in the Agile Web Development with Rails (4th edition) Updated for Rails 3.1 book.
Some environmental info that may help in answering this question:
$ cat /etc/issue
Ubuntu 10.04.2 LTS \n \l
$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
$ rails -v
Rails 3.1.0
Contents of the say.js.coffee file:
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
Ok, I've figured out what the issue was, and so I'll answer my own question.
The problem was the app/assets/javascripts/application.js file contained commented out code. However, one of the commented out lines was as follows:
//= require_tree .
When I delete this line everything works fine.
Hope this helps. If someone can provide some insight as to why the underscore was causing the issue that would be great.
I just ran into this issue when starting a new RoR 3.2.1 app. The problem is that you are missing a JS runtime, which is because the line
# gem 'therubyracer'
in your Gemfile has that # in front of it. God only knows why they ship Rails with that line commented, because any tutorial that uses generate scaffold or similar will result in the asset compilation process tripping up over the generated coffeescript file.
The solution is to uncomment that line. Installing another JS runtime may also solve the problem. See e.g. ExecJS and could not find a JavaScript runtime.
The official ruby on rails guide says:
Compiling CoffeeScript to JavaScript requires a JavaScript runtime and the absence of a runtime will give you an execjs error. Usually Mac OS X and Windows come with a JavaScript runtime installed. Rails adds the therubyracer gem to Gemfile in a commented line for new apps and you can uncomment if you need it. therubyrhino is the recommended runtime for JRuby users and is added by default to Gemfile in apps generated under JRuby. You can investigate about all the supported runtimes at ExecJS.
Simply delete the 2 lines from application.js
//= require turbolinks
//= require_tree
I had the same problem running rails 3.1.1
Once I reinstated the following code in my Gemfile, my issue disappeared:
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
This was placed in my Gemfile when initially setting up the project, i.e. using "rails new myapp".
Note that the in my template file I include:
<%= javascript_include_tag :application %>
Hope that helps
If you're on Windows and you used RailsInstaller to get your development going, you need to use that .bat file included with RailsInstaller to run your server. Also you can't use any CMD hook like conemu to start the server, unfortunately.
For the benefit of future Googlers, I went down a rabbit hole trying to install therubyracer until I stumbled upon this related post:
ExecJS::RuntimeError in rails 3.2.8 engine with javascript_include_tag
The link mentioned explains that ExecJS is configured incorrectly for Windows 8 out-of-the-box. In particular, the workaround described by pottsk did the trick for me.
https://github.com/sstephenson/execjs/issues/81#issuecomment-9892952
It involves changing the way that the cscript executable is run by ExecJS in %rubyinstall%\gems\2.0.0\gems\execjs-2.0.1\lib\execjs\runtimes.rb:
# JScript = ExternalRuntime.new(
# :name => "JScript",
# :command => "cscript //E:jscript //Nologo //U",
# :runner_path => ExecJS.root + "/support/jscript_runner.js",
# :encoding => 'UTF-16LE' # CScript with //U returns UTF-16LE
# )
JScript = ExternalRuntime.new(
:name => "JScript",
:command => "cscript //E:jscript //Nologo",
:runner_path => ExecJS.root + "/support/jscript_runner.js",
:encoding => 'UTF-8' # CScript with //U returns UTF-16LE
)
It goes without saying that this is not a permanent solution but it does get me up and running until the patch is incorporated.
Removing //= require_tree will just stop your javascript files from being loaded into rails. It will probably stop the error, but probably not what you'd like.
However, in my case, I had some .js.coffee files with incorrect indenting. Once I fixed this (by deleting them), it worked.
Another thing you can try which worked for me is to add the json (and perhaps also the yajl-ruby) gem to your Gemfile. I don't really understand why they weren't already installed before because:
rails depends on actionpack
which depends on sprockets
which depends on json and tilt
and tilt depends on yajl-ruby
Yet, somehow, it seems many of the dependent gems were not installed!?
In case of using linux(Ubuntu linux like mine), install javascript runtime. The best is issue the below command to install,
apt-get install nodejs
or else, for each and every new creation of rails project, add
gem 'therubyracer' to your gemfile and run bundle install
devise_scope :user do
get 'sign_out', :to => 'devise/sessions#destroy', :as => :destroy_user_session
end
If your routes.rb has this above line just delete it and run. This is what corrected my problem.
modify generator file (application.html.erb.tt) as the following:
<%= javascript_include_tag "application", "data-turbolinks-track" true %>
<%= javascript_include_tag :default, "data-turbolinks-track" true %>
Just REMOVE the following line (Line no. 6) from generator file (application.html.erb) :
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
please update me if there is any drawback to remove this line
Thanks
I have this issue in Rails 4, and if I switch it to 'defaults' rather than 'application', it works, just as the OP says. But this is in an external Gem that I'd rather not edit. I have found that if I force my Gemfile to use version 1.8.0 of coffee-script-source, do a bundle install, and start the server, then everything works fine.
Adding the gem 'therubyracer' fixed the issue.
I was getting the error only after adding external js file through <%= javascript_include_tag %>
So I just tried to install ckeditor in rails, however it doesn't look like its working.
Here is what I did
added these lines to my gemfile
gem "ckeditor", "~> 3.6.0"
gem "paperclip"
Then bundled installed and ran
rails generate ckeditor:install
rails generate ckeditor:models --orm=active_record
Added this file tom config/application.rb
config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
And then I tried out this code:
<%= javascript_include_tag :ckeditor %>
cktext_area_tag("test_area", "Ckeditor is the best")
cktext_area_tag("content", "Ckeditor", :input_html => {:cols => 10, :rows => 20}, :toolbar => 'Easy')
However, all I am getting is two textareas that do not have any editing ability. They look like normal textareas and all I can do is erase and add text.
What am I doing wrong?
This works like a charm, just tested it on rails 3.1.rc6. Also be cautious of the gem you are using. As of the moment of this post, the oficial gem was not working and was waiting for a pull request, so be sure to use fxposter's version of the gem in your gemfile.
https://github.com/fxposter/rails_3_1_with_ckeditor_and_carrierwave
I had the same setup as you and the same issue. With jalagrange's example app as a comparison to mine, I eventually found the issue to be in development.rb. I had to remove this line:
config.assets.debug = true
It worked for me with after that.
I had a similar issue when I was setting it up a while ago. I gave up on the gem eventually. The problem was getting ckeditor to behave in the asset pipeline, but I had mixed results depending on the browser (of course IE was the problem). Here is what worked for me:
Download ckeditor package from their site and drop in to public/ckeditor.
Then, directly include the javascript files.
<%= javascript_include_tag "/ckeditor/ckeditor" %>
<%= javascript_include_tag "/ckeditor/adapters/jquery" %>
Not exactly elegant, but it worked and haven't had to touch it since.
STEP 1: Add gem 'paperclip' and gem "ckeditor" in your gemfile.
STEP 2: Bundle Install.
STEP 3: rails generate ckeditor:install --orm=active_record --backend=paperclip
STEP 4: Place config.autoload_paths += %W(#{config.root}/app/models/ckeditor) in application.rb
STEP 5: Place mount Ckeditor::Engine => "/ckeditor" if not present already and run db:migrate
STEP 6: Open application.html.erb and place this <%= javascript_include_tag 'ckeditor/ckeditor.js' %> in header.
STEP 7: Place this in footer(above the body tag) in application.html.erb
<script type="text/javascript">$(document).ready(function() {
if ($('textarea').length > 0) {
var data = $('textarea');
$.each(data, function(i) {
CKEDITOR.replace(data[i].id);
});
}
});</script>
STEP 8: Restart the WEBrick SERVER.
That's it.