Getting Sinatra running on Ubuntu, Uninitialized constant error

六眼飞鱼酱① 提交于 2019-12-25 02:53:34

问题


Trying to get Sinatra setup on Ubuntu 12.04. I have RVM installed, and I think I have installed all dependencies (listed below). I found another SO post (here) that indicated I don't have libssl-dev installed, but it looks like I do. When I run:

sudo gem install sinatra

I get:

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 Version:

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

回答1:


Did you install RVM with OpenSSL option? Something like

rvm reinstall 1.9.2 --with-openssl-dir=/usr/local

Sometimes you stumble across issues if you have installed Ruby, IRB or RubyGems in System already (for example using apt-get) without RVM.

If not you may want to consider re-installing RVM with OpenSSL. Refer to RVM Documentation

I would also advice to install following packages before installing 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



回答2:


This error (uninitialized constant Gem::RemoteFetcher::OpenSSL) can occur if rubygems.org cannot be resolved via DNS. It just happened to me. Once DNS came back to its senses, gem install started working again.



来源:https://stackoverflow.com/questions/13956712/getting-sinatra-running-on-ubuntu-uninitialized-constant-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!