gpt4 book ai didi

ruby-on-rails - 加载错误 : cannot load such file -- gserver

转载 作者:太空宇宙 更新时间:2023-11-03 18:14:51 24 4
gpt4 key购买 nike

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

最初我都是通过 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 搞砸了,所以我回到了分支机构,但错误仍然存​​在。

任何 rake 调用都会返回这个:

$ 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与spring gem有关。运行 rake rails:update:bin 似乎有帮助,但我无法运行它,因为 rake 根本不起作用。

所以我尝试重新安装 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

关于ruby-on-rails - 加载错误 : cannot load such file -- gserver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27975312/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com