LoadError: cannot load such file -- gserver

LoadError: cannot load such file -- gserver

我想我搞砸了我的一个项目,现在它不会 运行 几乎任何命令。

最初我都是通过 RVM 安装的。 Gemfile 显示 rails 4.1.3

一段时间后,我想我可能会尝试更新 rails 并开始几个其他项目,rails 版本是 4.2.0,运行 都很好。

最近我又回到了第一个项目来部署它。我在配置 Capistrano 时发现我无法在我的工作机器上 运行 任何开发命令。首先我尝试 运行 服务器但是出现了这个错误:

$ rails server

bin/rails:6: warning: already initialized constant APP_PATH
/home/axl/coding/bfq/bin/rails:6: warning: previous definition of APP_PATH was here
Usage: rails COMMAND [ARGS]

The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the Rails server (short-cut alias: "s")
 dbconsole   Start a console for the database specified in config/database.yml
             (short-cut alias: "db")
 new         Create a new Rails application. "rails new my_app" creates a
             new application called MyApp in "./my_app"

In addition to those, there are:
 application  Generate the Rails application code
 destroy      Undo code generated with "generate" (short-cut alias: "d")
 plugin new   Generates skeleton for developing a Rails plugin
 runner       Run a piece of code in the application environment (short-cut alias: "r")

All commands can be run with -h (or --help) for more information.

所以我想也许我用 Capistrano 搞砸了,所以我回到了分支机构,但错误仍然存​​在。

任何佣金调用 returns 这个:

$ rake db:setup
rake aborted!
Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 10.3.2. Prepending `bundle exec` to your command may solve this.
/home/axl/coding/bfq/config/boot.rb:4:in `<top (required)>'
/home/axl/coding/bfq/config/application.rb:1:in `<top (required)>'
/home/axl/coding/bfq  fiscal-quadrum/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/home/axl/coding/bfq/config/boot.rb:4:in `<top (required)>'
/home/axl/coding/bfq/config/application.rb:1:in `<top (required)>'
/home/axl/coding/bfq/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

按照建议添加 bundle exec 显示另一个错误。例如:

$ bundle exec rake db:setup
rake aborted!
LoadError: cannot load such file -- gserver
/home/axl/coding/bfq/config/application.rb:7:in `<top (required)>'
/home/axl/coding/bfq/Rakefile:4:in `require'
/home/axl/coding/bfq/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

有类似情况,错误bin/rails:6: warning: already initialized constant APP_PATH与springgem有关。 运行 耙子 rails:update:bin 似乎有帮助,但我不能 运行 因为耙子根本不起作用。

所以我尝试重新安装 RVM。但是什么都没有改变。我什至删除了 RVM 并安装了 Rbenv。但是一切都一模一样

项目内版本:

$ ruby --version
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]

$ gem --version
2.4.5

$ rake --version
rake, version 10.4.2

$ rails --version
Rails 4.1.6

bundle update 进行了一些更新,但之后执行 rake 显示与前置 bundle exec:

相同的错误
$ rake
rake aborted!
LoadError: cannot load such file -- gserver
/home/axl/coding/bfq/config/application.rb:7:in `<top (required)>'
/home/axl/coding/bfq/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

谷歌搜索也没什么用LoadError: cannot load such file -- gserver

请帮帮我:'(

真丢人。我没有为项目定义 ruby 本地版本。

使用 RVM 时:

$ rvm install 2.1.1
$ rvm use 2.1.1

对于 Rbenv:

$ rbenv install 2.1.1
$ rbenv local 2.1.1