无法加载rails控制台

时间:2017-01-13 19:44:54

标签: ruby-on-rails ruby-on-rails-4 rubygems

我刚刚克隆了一个新的仓库并进行了捆绑安装和捆绑更新。我不知道为什么我在捆绑exec rails c时遇到以下错误。我正在使用rails版本5.0.1

bundler: failed to load command: rails (/Users/user123/.rbenv/versions/2.3.1/bin/rails)
Gem::LoadError: railties is not part of the bundle. Add it to Gemfile.
  /Users/user123/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/rubygems_integration.rb:336:in `block (2 levels) in replace_gem'
  /Users/user123/.rbenv/versions/2.3.1/bin/rails:22:in `<top (required)>'

我也在我的项目目录中。当我做轨道时我也得到了

Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]   
.....

gemfile如下所示

在wellness_client.gemspec

中指定gem的依赖项
gemspec

gem 'roll_out','~> 1.10.0'
gem 'roll_out-jira'
gem 'philter', '~> 1.11.0'

gem 'rake', '~> 11.0'

# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# An IRB alternative and runtime developer console
gem 'pry', '~> 0.9.12'
# Walk the stack in a Pry session
gem 'pry-stack_explorer', '~> 0.4.9'
# Simple, feature rich ascii table generation library
gem 'terminal-table', '~> 1.5', '>= 1.5.2'
# Great Ruby dubugging companion: pretty print Ruby objects to visualize their structure.
# Supports custom object formatting via plugins
gem 'awesome_print', '~> 1.6', '>= 1.6.1'

# BDD for Ruby
gem 'rspec', '~> 3.1'
# Code coverage for Ruby 1.9+ with a powerful configuration library and automatic merging of coverage across test suites
gem 'simplecov', '~> 0.7.1'
# factory_girl provides a framework and DSL for defining and using factories - less error-prone,
# more explicit, and all-around easier to work with than fixtures.
gem 'factory_girl', '~> 4.0'
# Faker, a port of Data::Faker from Perl, is used to easily generate fake data: names, addresses, phone numbers, etc.
gem 'faker', '~> 1.6', '>= 1.6.6'

由于

1 个答案:

答案 0 :(得分:0)

您的gemfile没有指定rails版本。 railties是rails的依赖项,它应该足以指定一个rails版本来解决这个问题。假设该项目是用rails 5编写的,请将此行添加到gemfile:

gem 'rails', '5.0.1'

现在重新运行bundle install并且rails console / server应该可以运行。