ruby-on-rails – Rails教程错误Cloud 9

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Rails教程错误Cloud 9前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
试图让这个工作,但我遇到了麻烦.我按照以下说明操作:
https://www.railstutorial.org/book/beginning#cha-beginning

我进入1.3.2并输入:

rails server -b $IP -p $PORT

这导致此错误而不是WEBrick运行:

/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/sass-rails-5.0.1/lib/sass/rails/helpers.rb:11:in `<top (required)>': uninitialized constant Sass::Script (NameError)
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `require'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/sass-rails-5.0.1/lib/sass/rails.rb:8:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `require'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/sass-rails-5.0.1/lib/sass-rails.rb:1:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:76:in `require'
        from /usr/local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from /usr/local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:72:in `each'
        from /usr/local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:72:in `block in require'
        from /usr/local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:61:in `each'
        from /usr/local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler/runtime.rb:61:in `require'
        from /usr/local/rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.6/lib/bundler.rb:133:in `require'
        from /home/ubuntu/workspace/hello_app/config/application.rb:7:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `require'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:78:in `block in server'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
        from /home/ubuntu/workspace/hello_app/bin/rails:8:in `require'
        from /home/ubuntu/workspace/hello_app/bin/rails:8:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
        from /usr/local/rvm/gems/ruby-2.1.5@rails4/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
        from /home/ubuntu/workspace/hello_app/bin/spring:13:in `require'
        from /home/ubuntu/workspace/hello_app/bin/spring:13:in `<top (required)>'
        from bin/rails:3:in `load'
        from bin/rails:3:in `<main>'

这似乎只有在您使用指定的代码替换Gemfile代码才能获得Ruby gem的显式版本(下面的代码)时才会发生这种情况.

来源’https://rubygems.org

gem 'rails','4.2.0'
gem 'sass-rails','5.0.1'
gem 'uglifier','2.5.3'
gem 'coffee-rails','4.1.0'
gem 'jquery-rails','4.0.3'
gem 'turbolinks','2.3.0'
gem 'jbuilder','2.2.3'
gem 'sdoc','0.4.0',group: :doc

group :development,:test do
  gem 'sqlite3','1.3.9'
  gem 'byebug','3.4.0'
  gem 'web-console','2.0.0.beta3'
  gem 'spring','1.1.3'
end

解决方法

看起来教程刚刚过时了.如果你更新你的gemfile
gem 'sass-rails','5.0.1'

gem 'sass-rails','5.0.2'

然后再次捆绑安装并启动服务器,它应该工作得很好.

(如果您愿意,还可以通过添加来运行解决方法

gem 'sass','3.4.13'

在您现有的非更新行之前:

gem 'sass-rails','5.0.1'

在您的gemfile中,并进行捆绑安装和启动服务器.不过,我不知道为什么你需要这样做.)

猜你在找的Ruby相关文章