2

我知道两种方法:

方法一:安装带端口的导轨,步骤如下:

  1. 安装 ruby​​,lang/ruby19

  2. 安装 gem, devel/ruby-gems

  3. 安装导轨,www/rubygem-rails

方法 2:使用 gem 安装 rails(在 Mac OS X 上相同):

  1. 安装 ruby​​,lang/ruby19

  2. 安装 gem, devel/ruby-gems

  3. 安装导轨,宝石安装导轨

方法1效果很好,但我想尝试方法2,完成方法2的所有步骤,我尝试使用命令创建我的第一个应用程序rails new hello,但失败了,错误如下:

在 FreeBSD 9.1 上构建 rails 开发/运行环境的最佳方法是什么?

/usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb:70:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb:70:in `block in connect'
    from /usr/local/lib/ruby/1.9/timeout.rb:54:in `timeout'
    from /usr/local/lib/ruby/1.9/timeout.rb:99:in `timeout'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb:70:in `connect'
    from /usr/local/lib/ruby/1.9/net/http.rb:755:in `do_start'
    from /usr/local/lib/ruby/1.9/net/http.rb:750:in `start'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/vendor/net/http/persistent.rb:628:in `start'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/vendor/net/http/persistent.rb:570:in `connection_for'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/vendor/net/http/persistent.rb:930:in `request'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/fetcher.rb:195:in `fetch'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/fetcher.rb:169:in `use_api'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/source/rubygems.rb:223:in `block in remote_specs'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/source/rubygems.rb:223:in `select'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/source/rubygems.rb:223:in `remote_specs'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/source/rubygems.rb:162:in `fetch_specs'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/source/rubygems.rb:66:in `specs'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/definition.rb:192:in `block (2 levels) in index'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/definition.rb:189:in `each'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/definition.rb:189:in `block in index'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/index.rb:9:in `build'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/definition.rb:185:in `index'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/definition.rb:179:in `resolve'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/definition.rb:114:in `specs'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/definition.rb:109:in `resolve_remotely!'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/installer.rb:83:in `run'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/installer.rb:14:in `install'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/cli.rb:247:in `install'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/vendor/thor/task.rb:27:in `run'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/vendor/thor.rb:344:in `dispatch'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/vendor/thor/base.rb:434:in `start'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/bin/bundle:20:in `block in <top (required)>'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/lib/bundler/friendly_errors.rb:4:in `with_friendly_errors'
    from /usr/local/lib/ruby/gems/1.9/gems/bundler-1.3.0/bin/bundle:20:in `<top (required)>'
    from /usr/local/bin/bundle:23:in `load'
    from /usr/local/bin/bundle:23:in `<main>'
4

4 回答 4

7

不要从你的包管理器安装 Ruby,更喜欢RBEnv来处理这个工作。在 FreeBSD 上使用它:

# as root
pkg_add -r bash curl git libxml2 libxslt node-devel sqlite3 sudo wget

# as user

# rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
git clone https://github.com/rbenv/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
echo 'eval "$(rbenv init -)"' >> ~/.profile
source ~/.profile

# ruby and rails
rbenv install 2.4.4
rbenv global 2.4.4
gem install rails

我希望这能帮到您 :)

资料来源:http ://chatchan.us/bsdonrails.pdf

于 2013-06-19T22:52:10.180 回答
0

无法重现。更新您的端口树并重试,也许您需要新版本的 devel/ruby-gems。

于 2013-03-01T02:42:19.737 回答
0

哈巴克斯击中了它的头部。我会支持你,但这是一个新帐户。对不起!

因为我使用 bash shell:.profile = .bash_profile

最新的 ruby​​ 版本正确安装。不过安装需要5分钟左右。

rbenv install 2.0.0-p247

为了兼容性和稳定性,我们使用 rails 3.2.13 而不是 4.0.0。

gem install rails -v 3.2.13
于 2013-07-18T06:44:55.373 回答
0

以 root 身份安装预构建的软件包:

pkg install ruby27-gems rbenv
gem install rails
于 2021-07-09T19:28:48.753 回答