安装捆绑器时出现问题,说它安装了,但实际上并没有安装
Problem installing bundler, Says it installs, but then doesn't actually install
我正在设置一个新系统。我使用的是 rbenv 而不是 rvm,因为 rvm 改变了 'cd' 的定义,那是邪恶的。
我已经安装了所需版本的 ruby 和 rails(我认为),但捆绑程序导致问题:
turlingdrome$ gem install bundler
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /Users/brianp/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/CHANGELOG.md
turlingdrome$ sudo gem install bundler
/usr/local/Cellar/rbenv/1.1.2/rbenv.d/exec/gem-rehash/rubygems_plugin.rb:6: warning: Insecure world writable dir /Users/brianp/work in PATH, mode 040777
Successfully installed bundler-2.0.1
Parsing documentation for bundler-2.0.1
Done installing documentation for bundler after 3 seconds
1 gem installed
turlingdrome$ sudo gem uninstall bundler
Gem 'bundler' is not installed
turlingdrome$ bundler install
Traceback (most recent call last):
2: from /Users/brianp/.rbenv/versions/2.5.3/bin/bundler:23:in `<main>'
1: from /Users/brianp/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
/Users/brianp/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundler (Gem::GemNotFoundException)
所以,我尝试使用 sudo 一次,现在我认为权限是超级用户...所以我正在使用 sudo。没什么大不了的。
似乎安装成功了。
当我尝试卸载时,它说没有安装。
当我尝试 运行 它时,它找到了一个可执行文件,但随后又说找不到可执行文件。
我正在使用 ruby 2.5.3 和 rails(我认为)5.2.3。
Rails 崩溃:
turlingdrome$ rails -v
/Users/brianp/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /Users/brianp/work in PATH, mode 040777
Traceback (most recent call last):
4: from bin/rails:3:in `<main>'
3: from bin/rails:3:in `require_relative'
2: from /Users/brianp/work/online-reporting/config/boot.rb:6:in `<top (required)>'
1: from /Users/brianp/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/Users/brianp/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
我认为这是同一个问题。
如果这很重要,我在mac。
使用 rbenv
是管理 Mac 上的 ruby
安装的一个很好的选择,但看起来你完成的 rbenv/gem/rails/bundler
安装一团糟和权限。它不值得修复它,所以我建议只删除 rbenv
,删除 ~/.rbenv
目录并安装 rbenv
和 brew
again using this guide。
其他检查方式:
运行 rbenv-doctor
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
删除~/.rbenv
目录,再次运行rbenv init
并安装所需版本的Ruby
检查 which ruby
和 which gem
是否指向 ~/.rbenv
目录中的适当位置
注意事项:
rbenv
和 brew
,以及 gem
不需要 sudo
,因此您永远不要将其与它们一起使用
- 不要忘记在 shell 初始化脚本中添加
eval "$(rbenv init -)"
,例如echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
你能试试吗?
gem install bundler --user-install
似乎是文件夹的权限问题。
permission denied @ rb_sysopen -
/Users/brianp/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/CHANGELOG.md
我会尝试使用 chmod 755 /Users/brianp/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/
更改上述文件/文件夹的权限
有几个帖子处理类似的主题,例如.
warning: Insecure world writable dir /Users/brianp/work in PATH, mode 040777
访问权限似乎有问题。试试这个:
sudo chmod 755 /Users/brianp/work
rbenv works by inserting a directory of shims at the front of your PATH:
~/.rbenv/shims:/usr/local/bin:/usr/bin:/bin
Through a process called rehashing, rbenv maintains shims in that directory to match every Ruby command across every installed version of Ruby—irb, gem, rake, rails, ruby, and so on.
Shims are lightweight executables that simply pass your command along to rbenv. So with rbenv installed, when you run, say, rake, your operating system will do the following:
- Search your
PATH
for an executable file named rake
- Find the rbenv shim named rake at the beginning of your
PATH
- Run the shim named
rake
, which in turn passes the command along to rbenv
您搞砸了 rbenv
安装。
1) Remove ruby installation outside rbenv
2) rvm implode
3) 从 ~/.bash_profile
或 ~/.bashrc
清理你的 $PATH
环境变量
删除指向 ruby
、irb
、gem
或任何文件夹(包括那些 bin 可执行文件)的任何 $PATH
引用。考虑对 bash_profile
中的任何 $PATH
语句进行评论
# export PATH="$HOME/etc/bin:$PATH"
# leave the statement below
# export PATH="$HOME/.rbenv/bin:$PATH
$PATH
变量包含文件夹列表:
echo $PATH
home/fabrizio/.rbenv/shims:/opt/android-studio/bin:~/.scripts/bin
如果你 运行 gem
在你的终端
home/fabrizio/.rbenv/shims
或 /opt/android-studio/bin
中包含的任何 .bin
可执行文件都可以从终端的任何位置执行。当你 运行 gem
时,the ruby
gem command 被执行而不是被 rbenv 拦截,因为你在 rbenv 之外安装了 ruby。
根据您的反馈进行更新
You must have followed this step when installing ruby 2.5.0 without rbenv 所以从你的 ~/.bash_profile
或 ~/.bashrc
中删除以下行
PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin"
或任何其他将 /Users/brianp/.gem/ruby/2.5.0/bin
添加到您的 $PATH
的行,然后是 uninstall ruby with apt.
Read the following information,此外,请务必使用 gem 环境检查 gem 的安装位置:
$ gem env home
# => ~/.rbenv/versions/<ruby-version>/lib/ruby/gems/...
如果终端中任意位置的位置不在 ~/.rbenv/
下,那么您正在将 gem 安装在错误的位置。
最后的手段
如果无法从 [=21] 中删除 /Users/brianp/.gem/ruby/2.5.0/bin
,请删除包含 rm -rf ~/.gem
、a similar approach to this post 的 gem 文件夹=]
上次错误的解决方案
这个错误是安装bundler 2.0
引起的
can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
您需要删除 bundler 2.0
并安装 1.9.0
尝试删除 Gemfile.lock
并再次尝试安装和使用捆绑器 - 我刚刚在 Github:
上找到了 that
Bundler 2 introduced a new feature that will automatically switch between Bundler v1 and v2 based on the lockfile [...] If you do, it can be fixed by installing the version of Bundler that is declared in the lockfile. This bug was fixed in RubyGems 3.0.0 but backports are now being prepared for previous major versions of RubyGems. We’ll let you know when they become available.
我正在设置一个新系统。我使用的是 rbenv 而不是 rvm,因为 rvm 改变了 'cd' 的定义,那是邪恶的。
我已经安装了所需版本的 ruby 和 rails(我认为),但捆绑程序导致问题:
turlingdrome$ gem install bundler
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /Users/brianp/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/CHANGELOG.md
turlingdrome$ sudo gem install bundler
/usr/local/Cellar/rbenv/1.1.2/rbenv.d/exec/gem-rehash/rubygems_plugin.rb:6: warning: Insecure world writable dir /Users/brianp/work in PATH, mode 040777
Successfully installed bundler-2.0.1
Parsing documentation for bundler-2.0.1
Done installing documentation for bundler after 3 seconds
1 gem installed
turlingdrome$ sudo gem uninstall bundler
Gem 'bundler' is not installed
turlingdrome$ bundler install
Traceback (most recent call last):
2: from /Users/brianp/.rbenv/versions/2.5.3/bin/bundler:23:in `<main>'
1: from /Users/brianp/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
/Users/brianp/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundler (Gem::GemNotFoundException)
所以,我尝试使用 sudo 一次,现在我认为权限是超级用户...所以我正在使用 sudo。没什么大不了的。
似乎安装成功了。
当我尝试卸载时,它说没有安装。
当我尝试 运行 它时,它找到了一个可执行文件,但随后又说找不到可执行文件。
我正在使用 ruby 2.5.3 和 rails(我认为)5.2.3。
Rails 崩溃:
turlingdrome$ rails -v
/Users/brianp/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /Users/brianp/work in PATH, mode 040777
Traceback (most recent call last):
4: from bin/rails:3:in `<main>'
3: from bin/rails:3:in `require_relative'
2: from /Users/brianp/work/online-reporting/config/boot.rb:6:in `<top (required)>'
1: from /Users/brianp/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/Users/brianp/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
我认为这是同一个问题。
如果这很重要,我在mac。
使用 rbenv
是管理 Mac 上的 ruby
安装的一个很好的选择,但看起来你完成的 rbenv/gem/rails/bundler
安装一团糟和权限。它不值得修复它,所以我建议只删除 rbenv
,删除 ~/.rbenv
目录并安装 rbenv
和 brew
again using this guide。
其他检查方式:
运行
rbenv-doctor
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
删除
~/.rbenv
目录,再次运行rbenv init
并安装所需版本的Ruby检查
which ruby
和which gem
是否指向~/.rbenv
目录中的适当位置
注意事项:
rbenv
和brew
,以及gem
不需要sudo
,因此您永远不要将其与它们一起使用- 不要忘记在 shell 初始化脚本中添加
eval "$(rbenv init -)"
,例如echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
你能试试吗?
gem install bundler --user-install
似乎是文件夹的权限问题。
permission denied @ rb_sysopen -
/Users/brianp/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/CHANGELOG.md
我会尝试使用 chmod 755 /Users/brianp/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/
有几个帖子处理类似的主题,例如
warning: Insecure world writable dir /Users/brianp/work in PATH, mode 040777
访问权限似乎有问题。试试这个:
sudo chmod 755 /Users/brianp/work
rbenv works by inserting a directory of shims at the front of your PATH:
~/.rbenv/shims:/usr/local/bin:/usr/bin:/bin
Through a process called rehashing, rbenv maintains shims in that directory to match every Ruby command across every installed version of Ruby—irb, gem, rake, rails, ruby, and so on.
Shims are lightweight executables that simply pass your command along to rbenv. So with rbenv installed, when you run, say, rake, your operating system will do the following:
- Search your
PATH
for an executable file named rake- Find the rbenv shim named rake at the beginning of your
PATH
- Run the shim named
rake
, which in turn passes the command along to rbenv
您搞砸了 rbenv
安装。
1) Remove ruby installation outside rbenv
2) rvm implode
3) 从 ~/.bash_profile
或 ~/.bashrc
$PATH
环境变量
删除指向 ruby
、irb
、gem
或任何文件夹(包括那些 bin 可执行文件)的任何 $PATH
引用。考虑对 bash_profile
$PATH
语句进行评论
# export PATH="$HOME/etc/bin:$PATH"
# leave the statement below
# export PATH="$HOME/.rbenv/bin:$PATH
$PATH
变量包含文件夹列表:
echo $PATH
home/fabrizio/.rbenv/shims:/opt/android-studio/bin:~/.scripts/bin
如果你 运行 gem
在你的终端
home/fabrizio/.rbenv/shims
或 /opt/android-studio/bin
中包含的任何 .bin
可执行文件都可以从终端的任何位置执行。当你 运行 gem
时,the ruby
gem command 被执行而不是被 rbenv 拦截,因为你在 rbenv 之外安装了 ruby。
根据您的反馈进行更新
You must have followed this step when installing ruby 2.5.0 without rbenv 所以从你的 ~/.bash_profile
或 ~/.bashrc
中删除以下行
PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin"
或任何其他将 /Users/brianp/.gem/ruby/2.5.0/bin
添加到您的 $PATH
的行,然后是 uninstall ruby with apt.
Read the following information,此外,请务必使用 gem 环境检查 gem 的安装位置:
$ gem env home
# => ~/.rbenv/versions/<ruby-version>/lib/ruby/gems/...
如果终端中任意位置的位置不在 ~/.rbenv/
下,那么您正在将 gem 安装在错误的位置。
最后的手段
如果无法从 [=21] 中删除 /Users/brianp/.gem/ruby/2.5.0/bin
,请删除包含 rm -rf ~/.gem
、a similar approach to this post 的 gem 文件夹=]
上次错误的解决方案
这个错误是安装bundler 2.0
can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
您需要删除 bundler 2.0
并安装 1.9.0
尝试删除 Gemfile.lock
并再次尝试安装和使用捆绑器 - 我刚刚在 Github:
Bundler 2 introduced a new feature that will automatically switch between Bundler v1 and v2 based on the lockfile [...] If you do, it can be fixed by installing the version of Bundler that is declared in the lockfile. This bug was fixed in RubyGems 3.0.0 but backports are now being prepared for previous major versions of RubyGems. We’ll let you know when they become available.