标签: rbenv

如何仅为单个项目切换我的 Ruby 版本?

我读到 rbenv 只能用于为单个项目切换 Ruby 环境。我的系统上安装了 Ruby 2.4,但我只想将 2.3 版用于特定项目。我认为使用“rbenv local”会治愈疼痛,但它不会......

localhost:myproject davea$ rbenv local 2.3.0
localhost:myproject davea$ bundle install
Your Ruby version is 2.4.0, but your Gemfile specified 2.3.0
localhost:myproject davea$ ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
Run Code Online (Sandbox Code Playgroud)

我如何只在这个项目中使用 Ruby 2.3?

ruby version project rbenv

3
推荐指数
1
解决办法
3725
查看次数

Ruby:捆绑包无法与 rbenv 一起使用(路径名包含空字节(ArgumentError)

我创建了一个 RubyGem,今天我打算更新依赖项,但现在进入 gem 的目录并输入后bundle install出现错误,其最后一行是:

/Users/myuser/.rbenv/versions/2.6.2/lib/ruby/2.6.0/rubygems/specification.rb:2663:in `directory?': path name contains null byte (ArgumentError)

我已经重新安装了捆绑程序,更新了系统 gem 等,但似乎没有任何效果。我怎样才能避免这种情况?

预先非常感谢!

ruby rubygems bundler rbenv

3
推荐指数
1
解决办法
974
查看次数

在 Mac OS 上安装 rbenv 后如何解决“没有这样的文件或目录”消息?

打开终端和/或使用 IDE 编写代码时,我收到以下消息:

-bash: export PATH="/Users/ryananding/.rbenv/shims:${PATH}"
export RBENV_SHELL=bash
source '/usr/local/Cellar/rbenv/1.1.2/libexec/../completions/rbenv.bash'
command rbenv rehash 2>/dev/null
rbenv() {
local command
command="${1:-}"
if [ "$#" -gt 0 ]; then
    shift
fi

case "$command" in
rehash|shell)
    eval "$(rbenv "sh-$command" "$@")";;
*)
    command rbenv "$command" "$@";;
esac
}: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我已按照https://github.com/rbenv/rbenv上的说明进行操作,并且 rbenv doctor 没有显示任何错误。任何帮助,将不胜感激。

ruby macos bash rbenv

3
推荐指数
1
解决办法
6643
查看次数

安装多个版本时,如何强制 jekyll 使用特定版本?

我正在建立自己的 Github 页面。我想在推送到远程仓库之前在本地机器上测试站点。我按照https://help.github.com/en/github/working-with-github-pages/creating-a-github-pages-site-with-jekyll的说明进行操作。

按照说明,我尝试了jekyll 3.8.5 new命令,因为 jekyll-3.8.5 是 github pages 使用的版本(https://pages.github.com/versions/)。但是,jekyll 在我的系统中找不到 3.8.5 版本。

这是在 macOS Catalina 上,安装了 rbenv 来管理 ruby​​ 版本。我尝试手动调用 jekyll 3.8.5 版。那完全有效。

以下是一些尝试的片段。gem list将 3.8.5 显示为可用版本。但是jekyll 3.8.5 new命令轰炸了。

$ gem list jekyll

*** LOCAL GEMS ***

jekyll (4.0.0, 3.8.6, 3.8.5)

$ which jekyll
/Users/deep/.gem/ruby/2.6.0/bin/jekyll

$ jekyll 3.8.5 new mygh-site
fatal: 'jekyll 3.8.5' could not be found. You may need to install the jekyll-3.8.5 gem or a related …
Run Code Online (Sandbox Code Playgroud)

rubygems jekyll rbenv github-pages

3
推荐指数
1
解决办法
1637
查看次数

为 Ruby on Rails 6 创建弹性 beanstalk 环境时遇到问题(rvm、rbenv、.ruby 版本问题)

我一直在尝试弄清楚如何使用 macOS 上的 cli 将简单的 Rails 应用程序部署到 Elastic beanstalk,但每次我都会收到eb create此错误:

2020/08/06 07:22:56.626563 [INFO] Executing instruction: StageApplication
2020/08/06 07:22:56.626674 [INFO] extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/
2020/08/06 07:22:56.626695 [INFO] Running command /bin/sh -c /usr/bin/unzip -q -o /opt/elasticbeanstalk/deployment/app_source_bundle -d /var/app/staging/
2020/08/06 07:22:56.638657 [INFO] finished extracting /opt/elasticbeanstalk/deployment/app_source_bundle to /var/app/staging/ successfully
2020/08/06 07:22:56.640331 [INFO] Executing instruction: RunAppDeployPreBuildHooks
2020/08/06 07:22:56.640351 [INFO] The dir .platform/hooks/prebuild/ does not exist in the application. Skipping this step...
2020/08/06 07:22:56.640356 [INFO] Executing instruction: stage ruby application
2020/08/06 07:22:56.640360 [INFO] stage …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails rvm rbenv amazon-elastic-beanstalk

3
推荐指数
1
解决办法
1441
查看次数

需要一个处理程序。传递 with: 关键字参数或提供一个块

最近我将我的应用程序从 Ruby 版本 2.6.1 更新到 3.0.1 并且我使用 rbenv 作为版本管理器。

但是当我尝试运行 Rails 服务器时出现错误

=> Booting Puma
=> Rails 6.1.3 application starting in development 
=> Run `bin/rails server --help` for more startup options
Exiting
/home/humayun/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3/lib/active_support/rescuable.rb:56:in `rescue_from': Need a handler. Pass the with: keyword argument or provide a block. (ArgumentError)
    from /home/humayun/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/will_paginate-3.1.8/lib/will_paginate/railtie.rb:67:in `rescue_from'
    from /home/humayun/umerfarooq/Alchemy/app/controllers/application_controller.rb:2:in `<class:ApplicationController>'
    from /home/humayun/umerfarooq/Alchemy/app/controllers/application_controller.rb:1:in `<main>'
Run Code Online (Sandbox Code Playgroud)

我刚刚阅读了有关导致第 56 行错误的函数的信息。

应用程序控制器.rb

 rescue_from Exception, with: :handle_exception
 protect_from_forgery prepend: true, with: :exception
 before_action :configure_permitted_parameters, if: :devise_controller?
 before_action :initialize_api

  def not_found
    raise …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails rbenv ruby-on-rails-6 ruby-3

3
推荐指数
1
解决办法
1263
查看次数

安装rbenv并更改Ruby版本后,Rake不再运行

安装Rbenv和Ruby 1.9.2和1.8.7,并设置当前项目的1.9.2(它以前使用1.8.7)后,耙将不再运行.运行rake routes给出消息:

Could not find rake-0.8.7 in any of the sources
Run `bundle install` to install missing gems.
Run Code Online (Sandbox Code Playgroud)

跑完后bundle install.

尝试bundle exec rake routes(这是安装Rbenv之前使用的方法)会产生以下错误:

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Library/Ruby/Gems/1.8/gems/bundler-1.0.9/lib/bundler/shared_helpers.rb:3.
Invalid gemspec in [/Users/jackrg/Documents/Novelty-Stats/vendor/local/ruby/1.8/specifications/jquery-rails-1.0.19.gemspec]: invalid date format in specification: "2011-11-26 00:00:00.000000000Z"
Invalid gemspec in [/Users/jackrg/Documents/Novelty-Stats/vendor/local/ruby/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
NOTE: Gem.source_index is deprecated, use Specification. It will be …
Run Code Online (Sandbox Code Playgroud)

rake ruby-on-rails bundler rbenv

2
推荐指数
1
解决办法
6112
查看次数

rbenv/ruby​​-build和共享库(libruby.so)

我试图使用rbenvruby-build.

看似成功安装了两个工具和ruby版本之后我找不到共享库libruby.so

当我安装ruby时,是否有任何特定的指令需要给rbenv/ruby​​-build?

尝试过ruby 2.1.02.1.2.

任何帮助,将不胜感激!

ruby rbenv

2
推荐指数
1
解决办法
1233
查看次数

rbenv:在UBUNTU 14.04(x86_64)上安装Ruby 2.2.3时建立失败

我正在尝试安装ruby 2.2.3,之前我已经安装了ruby 2.2.2,

rbenv versions
system  
* 2.2.2 (set by /home/emen/.ruby-version)
jruby-1.7.20
jruby-9.0.0.0.pre2Build
Run Code Online (Sandbox Code Playgroud)

尝试安装Ruby 2.2.3时出现问题,下面的构建失败:

rbenv install 2.2.3  
Downloading ruby-2.2.3.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.3.tar.bz2 Installing ruby-2.2.3...

BUILD FAILED (Ubuntu 14.04 using ruby-build 20160111-27-g06f1254)

Inspect or clean up the working tree at /tmp/ruby-build.20160127112741.26444 Results logged to /tmp/ruby-build.20160127112741.26444.log
Run Code Online (Sandbox Code Playgroud)

我检查了日志,只是复制了一部分嫌疑人,因为另一个检查和编译过程很好:

linking shared-object objspace.so
make[2]: Leaving directory `/tmp/ruby-build.20160127112741.26444/ruby-2.2.3/ext/objspace'
compiling ossl_ssl.c
make[2]: Entering directory `/tmp/ruby-build.20160127112741.26444/ruby-2.2.3/ext/pathname'
compiling pathname.c
ossl_ssl.c:141:27: error: ‘SSLv3_method’ undeclared here (not in a function)
     OSSL_SSL_METHOD_ENTRY(SSLv3),
                           ^
ossl_ssl.c:119:69: note: in definition of macro ‘OSSL_SSL_METHOD_ENTRY’
 #define OSSL_SSL_METHOD_ENTRY(name) …
Run Code Online (Sandbox Code Playgroud)

ruby openssl rbenv ubuntu-14.04

2
推荐指数
1
解决办法
1686
查看次数

升级的rbenv仍然无法安装ruby 2.4.0

我正在尝试使用rbenv安装ruby 2.4.0。

我正在使用自制软件。

当我尝试以下命令时:

rbenv install ruby 2.4.0 
Run Code Online (Sandbox Code Playgroud)

我得到以下内容:

ruby-build: definition not found: 2.4.0

The following versions contain `2.4.0' in the name:
  2.4.0-dev
  2.4.0-preview1
  rbx-2.4.0

See all available versions with `rbenv install --list'.

If the version you need is missing, try upgrading ruby-build:

  brew update && brew upgrade ruby-build
Run Code Online (Sandbox Code Playgroud)

我执行了brew更新和brew升级ruby-build命令,但仍然收到相同的消息,即未找到ruby-build定义2.4.0。

如何安装ruby 2.4.0并解决此问题?

ruby rbenv

2
推荐指数
1
解决办法
3188
查看次数