让Sinatra在Ubuntu上运行,未初始化的常量错误

时间:2012-12-19 16:23:50

标签: ubuntu gem sinatra

尝试在Ubuntu 12.04上安装Sinatra。我安装了RVM,我想我已经安装了所有依赖项(如下所列)。我发现另一个SO帖子(here)表示我没有安装libssl-dev,但它看起来像我一样。我跑的时候:

sudo gem install sinatra

我明白了:

ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::RemoteFetcher::OpenSSL 

rvm req installs:

sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsq
lite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
Note, selecting 'libncurses5-dev' instead of 'ncurses-dev'
autoconf is already the newest version.
automake is already the newest version.
bison is already the newest version.
curl is already the newest version.
git-core is already the newest version.
libncurses5-dev is already the newest version.
libreadline6 is already the newest version.
libtool is already the newest version.
libyaml-dev is already the newest version.
subversion is already the newest version.
zlib1g is already the newest version.
zlib1g-dev is already the newest version.
build-essential is already the newest version.
libc6-dev is already the newest version.
libsqlite3-dev is already the newest version.
libssl-dev is already the newest version.
libxml2-dev is already the newest version.
libxslt1-dev is already the newest version.
openssl is already the newest version.
sqlite3 is already the newest version.
The following packages will be REMOVED:
  libreadline-gplv2-dev
The following NEW packages will be installed:
  libreadline6-dev pkg-config
0 upgraded, 2 newly installed, 1 to remove and 7 not upgraded.
Need to get 40.9 kB/305 kB of archives.
After this operation, 201 kB of additional disk space will be used.
Do you want to continue [Y/n]? y

Ruby版本:

ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]

2 个答案:

答案 0 :(得分:1)

您是否使用OpenSSL选项安装RVM?像

这样的东西
rvm reinstall 1.9.2 --with-openssl-dir=/usr/local

如果您已经在系统中安装了Ruby,IRB或RubyGems(例如使用apt-get)而没有RVM,有时您会遇到问题。

如果不是,您可能需要考虑使用OpenSSL重新安装RVM。请参阅RVM Documentation

我还建议在安装RVM之前安装以下软件包

sudo apt-get install build-essential openssl libreadline6 libreadline6-dev \
curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 \
libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison  \
subversion pkgconfig

答案 1 :(得分:1)

此错误(未初始化的常量Gem :: RemoteFetcher :: OpenSSL) 如果无法通过DNS解析rubygems.org,就会发生这种情况。 它发生在我身上。一旦DNS恢复正常,宝石安装就开始了 再次工作。