rake db中的错误:在新的rails项目中创建

时间:2016-01-31 18:48:04

标签: ruby-on-rails ruby-on-rails-4 sass rake

我收到以下错误:

耙子中止了!
NameError:未初始化的常量Sass :: Script /home/nikhil/Nurture/careerpal-back/config/application.rb:7:in <top (required)>' /home/nikhil/Nurture/careerpal-back/Rakefile:4:in&#39; (通过使用--trace运行任务查看完整跟踪)

Gemfile是

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
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.3'
# 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

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

我已经通过运行bundle update将所有宝石更新为最新版本,并将sass-rails gem更改为特定版本。它仍然不会运行

Gemfile.lock有这些行

sass (3.4.21)
sass-rails (5.0.4)
  railties (>= 4.0.0, < 5.0)
  sass (~> 3.1)
  sprockets (>= 2.8, < 4.0)
  sprockets-rails (>= 2.0, < 4.0)
  tilt (>= 1.1, < 3)

但是运行bundle install给了我这个:

Using sass 3.4.21
Using sass-rails 5.0.4

编辑: 我之前用4.2.4创建了一个api only rails项目。它没事。

帮助表示感谢。在此先感谢。

2 个答案:

答案 0 :(得分:0)

首先按步骤运行:

gem install bundler

然后

bundle install

&安培;然后

bundle exec rake db:create

要了解bundler,请创建导轨project

希望能帮到你

答案 1 :(得分:0)

我只是重新安装了ruby + rails,事情还不错。

我删除了〜/ .rbenv文件夹并运行了sudo apt-get purge ruby

然后使用Official Page安装ruby和rails。

重要的是,一旦我创建了一个新项目,我就会被提示安装另一个gem来解决一些依赖关系gem install rdoc-data