gpt4 book ai didi

ruby-on-rails - 无法将瘦服务器作为服务启动,RubyGems : Could not find thin

转载 作者:行者123 更新时间:2023-12-04 18:12:37 27 4
gpt4 key购买 nike

我按照以下说明在使用Rails 3.2.3的Ubuntu 10.04.4上将Thin Server作为服务安装和配置:

http://articles.slicehost.com/2008/5/6/ubuntu-hardy-thin-web-server-for-ruby

瘦服务器可以使用“thin start”从应用程序根目录正常运行

但是,当我尝试使用以下任何命令运行服务时:

service thin start
sudo service thin start
/etc/init.d/thin start
sudo /etc/init.d/thin start

我收到以下错误:
/home/myuser/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find thin (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /home/myuser/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /home/myuser/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
from /home/myuser/.rvm/gems/ruby-1.9.3-p125/bin/thin:18:in `<main>'

这似乎不是PATH的问题,“thin thin”正确返回:
home/myuser/.rvm/gems/ruby-1.9.3-p125/bin/thin

我也已经验证了**/bin/thin是否存在

我尝试使用'gem uninstall thin','gem install thin'重新安装gem,但未成功

有谁之前经历过这个吗?我只发现了此问题的另一个实例:
Cannot restart thin via remote machine

这个问题似乎只是在ssh上,尽管我什至无法在本地启动瘦服务

谢谢

最佳答案

似乎每个启 Action 业都加载了自己的shell。因此,在尝试开始精简之前,请尝试加载rvm:

#! /bin/sh
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then

# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"

elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then

# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"

else

printf "ERROR: An RVM installation was not found.\n"

fi

rvm use 1.9.3
cd /path/to/your/application/code
bundle exec thin -d

将此放置在 /etc/init.d/thin_service中并运行
$ sudo update-rc.d  thin_service defaults

最后,您可以通过简单地键入 sudo start thin_servicesudo stop start_thin而不是重新启动来进行测试。如果仍然无法解决问题,请尝试使用railsgems-bundler和rvm包装器。另外,请阅读 rvm's Deployment Best Practices

关于ruby-on-rails - 无法将瘦服务器作为服务启动,RubyGems : Could not find thin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10390040/

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