2016-07-27 35 views
0

我是Ruby on Rails的新手,我一直在關注如何使用Devise,Haml和Simple_Form創建論壇應用程序的Mackenzie Child的教程。我在Windows 10 O.S.上使用Aptana Studio 3作爲IDE。我正在使用Ruby 2.2.0和Rails版本4.2.5.1。Rails寶石和服務器的持續問題

我有兩個問題:

1)我無法摧毀它創建後的後(如麥肯錫說明在大約時間爲17:30)。

經過Google搜索,我發現這是因爲我從application.html.erb中刪除了JavaScript和StyleSheet腳本。我刪除了這些代碼行,因爲我無法查看本地服務器上的任何Rails應用程序。這導致我到我的第二個問題

2)我把代碼行回到application.html.erb文件夾,我回到無法查看我的本地網絡上的應用程序,並收到以下列出的錯誤代碼。

同樣,谷歌的搜索發現coffee-script-source,1.10.0不適用於windows,這就是爲什麼我收到錯誤。我被建議回滾到1.8.0。但是,我無法回滾到早期版本。我嘗試在我的GemFile中輸入正確的CoffeeScript版本,並嘗試gem install'coffee-script-source','1.8.0',但是我的電腦拒絕更新它。相反,我在終端中收到此錯誤。

>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'"* 

無論如何,這是Google停止幫助的地方。如果有人能幫助我解決這個問題,我將不勝感激!

[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] 
+0

嘗試運行'gem'coffee-script-source','〜> 1.8.0''並運行'bundle update' – mrvncaragay

+0

謝謝!這解決了它。 –

回答

1

您的寶石在安裝時會進行版本控制。因此,曾經有一段時間,您可能沒有指定版本coffee-script-sourcebundler熄滅並安裝了最新版本的1.10.0。現在你試圖告訴它安裝一個不同的版本,並且它已經安裝了一個版本,因此它很瘋狂。

現在你已經在你的Gemfile可以運行bundle update coffee-script-source指定的=1.8.0的版本,它應該讓你正確的版本並鎖定在你的Gemfile.lock要記住,是你想要的版本。

+1

哇!那很簡單。我沒有意識到你必須專門提到這個寶石才能運作。非常感謝! –

+0

沒問題。很高興我能幫上忙。隨意標記我的答案是正確的! – ericsaupe