Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 无法加载这样的文件--unicorn/version(LoadError)_Ruby On Rails_Ruby_Gem_Rvm_Unicorn - Fatal编程技术网

Ruby on rails 无法加载这样的文件--unicorn/version(LoadError)

Ruby on rails 无法加载这样的文件--unicorn/version(LoadError),ruby-on-rails,ruby,gem,rvm,unicorn,Ruby On Rails,Ruby,Gem,Rvm,Unicorn,试图从WEBrick切换到Unicorn,我已经在我的机器上安装了Unicorn gem v 4.8.1[通过“gem install Unicorn”],它也位于我的Gemfile[“gem”Unicorn”,“~>4.8.1”],我已经成功运行了捆绑安装 但是,当通过“rails s”(在Unicorn之前运行良好)在本地启动服务器时,我得到以下错误: ...../vendor/cache/ruby/1.9.1/gems/unicorn-4.8.1/lib/unicorn/const.rb:

试图从WEBrick切换到Unicorn,我已经在我的机器上安装了Unicorn gem v 4.8.1[通过“gem install Unicorn”],它也位于我的Gemfile[“gem”Unicorn”,“~>4.8.1”],我已经成功运行了捆绑安装

但是,当通过“rails s”(在Unicorn之前运行良好)在本地启动服务器时,我得到以下错误:

...../vendor/cache/ruby/1.9.1/gems/unicorn-4.8.1/lib/unicorn/const.rb:44:in `require': cannot load such file -- unicorn/version (LoadError)
    from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/unicorn-4.8.1/lib/unicorn/const.rb:44:in `<top (required)>'
    from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/unicorn-4.8.1/lib/unicorn.rb:108:in `require'
    from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/unicorn-4.8.1/lib/unicorn.rb:108:in `<top (required)>'
    from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /Users/johndoe/Sites/my_app/config/application.rb:7:in `<top (required)>'
    from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require'
    from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
    from /Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
另外,我的$PATH:
/Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/bin/gem:/usr/local/rvm/bin:/Users/joh供参考‌​ndoe/.rvm/gems/ruby-1.9.3-p392/bin:/Users/johndoe/.rvm/gems/ruby-1.9.3-p392@globa‌​l/bin:/Users/johndoe/.rvm/rubies/ruby-1.9.3-p392/bin:/Users/johndoe/.rvm/bin:/usr‌​/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin

“bundle show unicorn”提供:/Users/johndoe/Sites/my_app/vendor/cache/ruby/1.9.1/gems/unicorn-4.8.1

该应用程序已成功部署到Heroku,因此我认为此问题与我的机器无关(而不是应用程序的问题)。有什么解决方法吗?

您可以使用此

$ rails server unicorn


我似乎通过“sudo bundle exec gem uninstall unicorn”卸载gem,然后通过标准的“sudo bundle install”重新安装它,从而解决了这个问题


仍然不确定问题发生的确切原因,但该修复似乎确实起了作用。

仍然不确定是什么原因导致了此问题

我通过重新安装独角兽宝石解决了这个问题。

gem卸载独角兽
捆绑安装

bundle update

使用输出@МаъСъСъъ哪个输出?更新帖子,并提供
bundle show unicorn
的输出,以及
ls$(bundle show unicorn)/lib/unicorn/version
您作为注释@МааССъъъъъI提供的输出。我已更新帖子-没有ls$(bundle show unicorn)/lib/unicorn/version目录-虽然有一个ls$(bundle show unicorn)/lib/unicorn/directory在一天内使用了两次。由于命令要求我卸载两个不同的版本,它们在某种程度上存在冲突。
$ rails server unicorn
bundle exec unicorn -p 3000