0

I am building a new app from scratch. Just started last week learning RoR. I've been following tutorials that work perfect except:

I was trying to install Bootstrap when the Error came out.

SO:

Windows 10

Versions of the enviroment I am working are:

Ruby 2.2.4 Rails 4.2.5.1

Followed the instructions of https://github.com/twbs/bootstrap-sass step by step. (Installed gems, put the @import lines, etc)

The error I get is the following:

ExecJS::ProgramError... ...application.html.erb where line #5 raised: TypeError: Object doesn't support this property or method

Googled and found a solution:

If I change to 'default' from 'application' in application.html.erb the Error disappears, but I do not get the bootstrap styling. Everything just goes back to normal.

Files:

Gemfile

source 'https://rubygems.org'

gem 'rails', '4.2.5.1'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :development, :test do
  gem 'sqlite3'
  gem 'byebug'
end

group :development do
  gem 'web-console', '~> 2.0'
end

group :test do
  gem 'minitest-reporters'
  gem 'mini_backtrace'
  gem 'guard-minitest'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
end

application.css.scss

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 */

 @import "bootstrap-sprockets";
 @import "bootstrap";

application.js

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require bootstrap-sprockets

application.html.erb

<%= stylesheet_link_tag 'application', :media => "all" %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %> ...

Another issue that I encounter:

When using link_tofor the action of destroy, nothing seems to change.

Googling, I found that if I change to button_to, the destroy action works perfectly, but it is an issue I think that should be corrected.

aleherzko
  • 90
  • 1
  • 10
  • Please paste in your application.css.scss, the file where you include bootstrap css (could be anything.scss, just whatever has your import lines), your application.js or application.coffee, and your application.html.erb. That line just means it couldn't read the compiled assets properly, to know why, it's easier to see those files. – trh May 02 '16 at 19:59
  • Ok, edited the OP. – aleherzko May 02 '16 at 20:11
  • ok - use 'defaults' in the js include, to work around a potential windows / js bug. However do NOT use defaults in the style stylesheet_link_tag, leave that as application. Secondly add =* require_self to the application.scss file, this will make sure bootstrap is loaded before any other css files you add. -- see if that gives you the same error – trh May 03 '16 at 00:00

1 Answers1

0

So I fixed it doing the following:

  1. Downloaded node.js and installed it.
  2. Found the ExecJS's runtimes.rb file here: \RUBYINSTALLATIONFOLDER\lib\ruby\gems\2.2.0\gems\execjs-2.6.0\lib\execjsand changed it as answer option 3 of ExecJS::RuntimeError on Windows trying to follow rubytutorial
Community
  • 1
  • 1
aleherzko
  • 90
  • 1
  • 10