ruby – zsh:command not found:bundle(gem安装bundle后)

为什么找不到zsh:命令找不到:bundle after gem install bundler?

我尝试设置path =(/usr/local/lib/ruby/gems/2.2/gems/~ / bin / bin / sbin /usr/bin/usr / sbin /usr/local / bin /usr/local / sbin) / etc / zshrc和source / etc / zshrc无效.

root@dev:/home/dev# gem install bundler
Successfully installed bundler-1.7.12
Parsing documentation for bundler-1.7.12
Done installing documentation for bundler after 10 seconds
1 gem installed

root@dev:/home/dev# bundle
zsh: command not found: bundle

root@dev:/home/dev# uname -a
OpenBSD dev.my.domain 5.7 GENERIC#748 amd64

root@dev:/home/dev# gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.5
  - RUBY VERSION: 2.2.0 (2014-12-25 patchlevel 0) [x86_64-openbsd]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.2
  - RUBY EXECUTABLE: /usr/local/bin/ruby22
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYstem CONfigURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-openbsd
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/2.2
     - /usr/local/lib/ruby/gems/2.2/gems/
  - GEM CONfigURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/lib/ruby/gems/2.2/gems/
     - /root/bin
     - /bin
     - /sbin
     - /usr/bin
     - /usr/sbin
     - /usr/local/bin
     - /usr/local/sbin

解决方法

您似乎是在系统范围内安装bundler之后.为此,您需要将–no-user-install标志传递给gem并使用sudo执行它:
sudo gem install bundler --no-user-install

之后,您应该看到/usr/bin /中的bundle很好:

$ls /usr/bin/bundle
/usr/bin/bundle*

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...