我让Sinatra和Chartkick在Windows开发机器上工作。现在我想将它移到服务器上,以便其他人可以轻松访问它。
以下是有关我的服务器的一些相关详细信息:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.2 LTS
Release: 12.04
Codename: precise
$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
$ gem -v
1.8.15
$ gem list --local
*** LOCAL GEMS ***
chartkick (1.2.4)
rack (1.5.2)
rack-protection (1.5.3)
sinatra (1.4.5)
tilt (1.4.1)
$ cat example.rb
require 'rubygems'
require 'sinatra'
#require 'chartkick'
get '/' do
"Hello World"
end
$ ruby example.rb
== Sinatra/1.2.6 has taken the stage on 4567 for development with backup from WEBrick
[2014-06-06 01:55:43] INFO WEBrick 1.3.1
[2014-06-06 01:55:43] INFO ruby 1.9.3 (2011-10-30) [x86_64-linux]
[2014-06-06 01:55:43] INFO WEBrick::HTTPServer#start: pid=9574 port=4567
**<<<redacted>>>** - - [06/Jun/2014 01:55:53] "GET / HTTP/1.1" 200 11 0.0029
**<<<redacted>>>** - - [06/Jun/2014:01:55:53 PDT] "GET / HTTP/1.1" 200 11
- -> /
^C
== Sinatra has ended his set (crowd applauds)
[2014-06-06 01:56:01] INFO going to shutdown ...
[2014-06-06 01:56:01] INFO WEBrick::HTTPServer#start done.
**<<<removed # from in front of chartkick>>>**
$ ruby example.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- chartkick (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from example.rb:3:in `<main>'
任何人都有任何线索为什么要求失败,或者我能尝试什么?我确实有一个&#34; public&#34;带&#34; chartkick.js&#34;的文件夹在它。
答案 0 :(得分:0)
为了关闭循环:我安装了多个版本的ruby,并且在安装gem之前我没有将链接更改为1.9.3。所以在我指向1.9.3可执行文件的ruby链接和1.9.3版本的gem链接之后,我重新安装了gem,现在它可以正常工作。