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

标签 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 安装:
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]

最佳答案

您是否安装了带有 OpenSSL 选项的 RVM?就像是

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

如果您已经在没有 RVM 的情况下在 System 中安装了 Ruby、IRB 或 RubyGems(例如使用 apt-get),有时您会偶然发现问题。

如果没有,您可能需要考虑使用 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

关于ubuntu - 让 Sinatra 在 Ubuntu 上运行,未初始化的常量错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13956712/

相关文章:

linux - Linux Ubuntu下启动时自动运行程序

javascript - 创建 Ruby Gem 以将 HTML/JavaScript 插入主应用程序

ruby - 为什么 "gem"和 "bundle"不使用相同的 libxml2?

sinatra - 如何使用 Sinatra 服务 500 个页面?

ruby - sinatra 使用 ctrl z 停止——现在它不会重新启动,因为它说端口 4567 已被使用

android - adb 设备命令不起作用

Linux : Copy Multiple files and remove it's extension

postgresql - 使用 Postgres 数据库时调用了哪些函数

ruby - 如何安装旧版本的 Jekyll?

ruby - 如何在 Sinatra 中为 JSON 定义全局错误处理程序