'Rails CSS, JS, and jQuery TypeErrors (for Windows) [duplicate]

It has recently come to light that my program is experiencing plenty of errors on the localhost:3000 server. I'm quite new to Ruiby on Rails and jQuery, however I realize this is a windows specific error and I believe that my program lacks any real errors so far.

My rails version is the latest (5.0.0.1), my ruby version is 2.2.4 and currently whenever I start up my localhost I receive this error:

TypeError: Object doesn't support this property or method

<head>
    <title>Blog</title>
    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
 <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
 <%= csrf_meta_tags %>
</head>

However, it seems that whenever I change the 'application' tag to whatever I want, it seems to work and run the localhost properly. For example, I changed it to 'default'.

<%= stylesheet_link_tag    'default', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'default', 'data-turbolinks-track': 'reload' %>

Now usually the application.css code should be automatically implemented into my views, but that doesn't work now since I changed the tags above to 'default'. To counter this, I first tried to use the

<%= stylesheet_link_tag "default" %> 

But returned the same

TypeError: Object doesn't support this property or method

After, I decided to create a new CSS file named 'default.css' in order to match the application.html.erb code. Still returns the same TypeError problem.

I've rerun bundle install countless times, checked all my gems, created new projects but this problem still persists.



Solution 1:[1]

Try changin your code to this

   <%= stylesheet_link_tag 'defaults', media: 'all', 'data-turbolinks-track' => true %>
 <%= javascript_include_tag 'defaults', 'data-turbolinks-track' => true %>

Rails don't go very well with Windows. The problem is related to the assets compiling. Also you can try installing node.js https://nodejs.org/en/download/.

You can get more info in this answers Possible to get Rails 4 working on Windows?

Solution 2:[2]

Coffee script 1.9.0 doesn't play well with Windows. On my Windows 7 machine, using version 1.8.0 solved this problem.

Add to Gemfile

gem 'coffee-script-source', '1.8.0'

then, run

bundle update coffee-script-source

and restart the server (if needed)

I found the solution here and click link for further information.

downgrading the gem coffee-script-source' from 1.9.1 to 1.8.0

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community
Solution 2 TylerH