2016-07-27 68 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