Kevin Smith Kevin Smith - 4 months ago 46
CoffeeScript Question

Ongoing issue with Rails gems and server

I am new to Ruby on Rails, and I have been following Mackenzie Child's tutorial on how to make a Forum app using Devise, Haml, and Simple_Form. I'm using Aptana Studio 3 as an IDE on Windows 10 O.S. I'm using Ruby 2.2.0 and Rails version 4.2.5.1.

I'm having two issues:

1) I am unable to destroy a post after creating it (as Mackenzie illustrates at around time = 17:30).

After a Google search I discovered this is because I removed the JavaScript and StyleSheet scrips from

application.html.erb
. I removed these lines of code because I was unable to view any Rails app on a local server. This leads me to my second problem

2) I put the lines of code back into the
application.html.erb
folder and I am back to being unable to view my app on my local network, and receive error code listed below.

Again, a Google search found that
coffee-script-source
,
1.10.0
doesn't work well with windows, and that is why I received the error. I was suggested to rollback to
1.8.0
. However, I am unable to rollback to an earlier version. I tried typing the correct version of CoffeeScript into my GemFile, and tried
gem install
'coffee-script-source', '1.8.0', but my computer refuses to update to it. Instead I receive this error in the Terminal.

>You have requested: coffee-script-source = 1.8.0
>The bundle currently has coffee-script-source locked at 1.10.0.
>Try running 'bundle update coffee-script-source'
>If you are updating multiple gems in your Gemfile at once,
>try passing them all to 'bundle update'"*


Anyway, this is where Google has stopped being helpful. I would appreciate if anybody could help me with this issue!

[https://www.youtube.com/watch?v=rTP1eMfI5Bs]

><!DOCTYPE html>
><html>
> <head>
> <title>Forum</title>
> <%= csrf_meta_tags %>
>
> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-

>track': 'reload' %>
> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' >%>
></head>
>
><body>
><%= yield %>
> </body>
></html>


.

>ExecJS::ProgramError in Posts#index
>Showing c:/psychweb/forum/app/views/layouts/application.html.erb where line #7 raised:
>
>TypeError: Object doesn't support this property or method
>Rails.root: c:/psychweb/forum
>
>Application Trace | Framework Trace | Full Trace
>app/views/layouts/application.html.erb:7:in
>`_app_views_layouts_application_html_erb__95882101_42750912'


.

>gem 'rails', '4.2.5.1'
># Use sqlite3 as the database for Active Record
>gem 'sqlite3'
># Use SCSS for stylesheets
>gem 'sass-rails', '~> 5.0'
># Use Uglifier as compressor for JavaScript assets
>gem 'uglifier', '>= 1.3.0'
># Use CoffeeScript for .coffee assets and views
>gem 'coffee-rails', '~> 4.1.0'
># See https://github.com/rails/execjs#readme for more supported runtimes
># gem 'therubyracer', platforms: :ruby
>gem 'jquery-rails'
>gem 'turbolinks'
>gem 'jbuilder', '~> 2.0'
># bundle exec rake doc:rails generates the API under doc/api.
>gem 'sdoc', '~> 0.4.0', group: :doc
>
>gem 'haml', '~> 4.0.5'
>gem 'simple_form', '~> 3.0.2'
>gem 'devise', '~> 3.4.1'
>gem 'coffee-script-source', '=1.8.0'
>
># Use ActiveModel has_secure_password
># gem 'bcrypt', '~> 3.1.7'
>
>
>group :development, :test do
> gem 'byebug'
>end
>
>group :development do
>
> gem 'web-console', '~> 2.0'
>end
>
>
># Windows does not include zoneinfo files, so bundle the tzinfo-data gem
>gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Answer

Your gems are versioned when they install. So once upon a time you may not have specified the version of coffee-script-source and bundler went out and installed the latest version of 1.10.0. Now you are trying to tell it to install a different version and it's mad because it already has a version installed.

Now that you have specified the version of =1.8.0 in your Gemfile you can run bundle update coffee-script-source and it should get you the proper version and lock that in your Gemfile.lock to remember that is the version you want.

Comments