6

I'm working on a simple ruby on rails application and I am getting the following error:

TypeError: Cannot read property 'process' of undefined (in/home/saasbook/Documents/projects/Bookkeeper/app/assets/stylesheets/application.css.sass)

The Extracted source is as follows:

<html>
<head>
<title>Bookkeeper</title>
<%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %> //Highlighted error line in extract
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>

This error occurred after I added Bootstrap Sass by Using the Bootstrap Sass plugin and following this tutorial

Below the extract its stated that the error is at:

app/views/layouts/application.html.erb:5:in_app_views_layouts_application_html_erb__226809778_88444660'

My code

application.html.erb

<!DOCTYPE html>
<html>
 <head>
 <title>Bookkeeper</title>
    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>  //Highlighted error line in extract
    <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
    <%= csrf_meta_tags %>

 </head>
 <body>
    <%= yield %>
 </body>        
</html>

application.css.sass

/*
* 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 vendor/assets/stylesheets of plugins, if any, 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.
*
*= require_tree 
*= require_self
*/

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

The page shows this title in the red border on top, is this any help?

ExecJS::ProgramError in Portal#index

anonn023432
  • 2,940
  • 6
  • 31
  • 63
  • If you remove the contents of `application.css.sass` do you still get the error? – Magnuss Jan 14 '15 at 15:51
  • @Magnuss tried doing that, but I am still getting the same error. If you notice that though the line above extract states that the error is in `application.css.sass` but it is actually in `application.html.erb`, editing the question to make that clear. – anonn023432 Jan 14 '15 at 15:57
  • Is the above a copy/paste error, or is your `head` indented within your `html`...and the `title`, `stylesheets`, `javascripts`, etc indented within the `head`? – Justin Jan 14 '15 at 16:13
  • @JustinLicata it is the ready-made view made by rails so I don't expect there to be an error of that sort. Also, I never knew that indentation in HTML can cause errors. – anonn023432 Jan 14 '15 at 16:21
  • Just had to ask :)...you never know...Are you able link us to the code on GitHub..since it's a tutorial? In order to properly help debug this with you, seeing the code will help tremendously. – Justin Jan 14 '15 at 16:21
  • @JustinLicata sorry can't add the link to my github, followed the tutorial to add Sass as I have never used Sass before but it is part of a bigger project and the repo is private but I have added the relevant code. – anonn023432 Jan 14 '15 at 16:35
  • 1
    does this help? http://stackoverflow.com/a/11782229/2456549 – Justin Jan 14 '15 at 16:40
  • @JustinLicata Tried that, still getting the same error :/ – anonn023432 Jan 14 '15 at 16:52
  • Versions of rails, ruby, etc. ? – crackedmind Jan 14 '15 at 16:55
  • 1
    That is a very strange bug, I was getting it after creating a new Rails 4.2 app with Bootstrap with Autoprefixer. I just reloaded the app a couple of times while commenting out autoprefixer or bootstrap gem and it magically started to work. – Ilya Bodrov-Krukowski Jan 14 '15 at 17:02
  • @crackedmind rails 4.1.5, 1.9.3p448 (2013-06-27 revision 41675) [i686-linux] – anonn023432 Jan 14 '15 at 17:19
  • @bodrovis so did you have both of them uncommented when it started to work or not? – anonn023432 Jan 14 '15 at 17:20
  • I just took my previous github file and again installed bootstrap-rails and it seems to be working fine. @JustinLicata I followed your advice and uncommented rubyracer, thanks for the help. :) – anonn023432 Jan 14 '15 at 18:25

2 Answers2

8

There seems to be an issue with version 5.0 of the autoprefixer-rails gem. Try downgrading to 4.0.2.2.

https://github.com/ai/autoprefixer-rails/issues/47

This will pop up if you are using Node instead of RubyRacer as your JS runtime.

EDIT - This has been fixed in the latest version of autoprefixer.

bundle update autoprefixer-rails
learning_to_swim
  • 351
  • 3
  • 14
0

This has been fixed in the latest release of autoprefixer. Upgrade using the following command -

bundle update autoprefixer-rails
learning_to_swim
  • 351
  • 3
  • 14