热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

zsh:命令未找到:bundle(gem安装bundle后)-zsh:commandnotfound:bundle(aftergeminstallbundle)

Whyzsh:commandnotfound:bundleaftergeminstallbundler?为什么zsh:命令未找到:gem安装bundler后绑定?Itrie

Why zsh: command not found: bundle after gem install bundler?

为什么zsh:命令未找到:gem安装bundler后绑定?

I tried setting path=( /usr/local/lib/ruby/gems/2.2/gems/ ~/bin /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin ) in /etc/zshrc and source /etc/zshrc to no avail.

我尝试在/etc/zshrc和source /etc/zshrc中设置path=(/usr/ local/lib/ruby/gems/2/gems/ ~/bin /bin /sbin /sbin /usr/ usr/sbin /sbin /usr/local/sbin),但没有任何效果。

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

4 个解决方案

#1


19  

I had the same issue using zsh and this fixed it:

我在使用zsh时遇到了同样的问题,这个问题解决了:

  • echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
  • = " $ HOME / echo的出口路径。rbenv / bin:$ " > > ~ / .zshenv路径
  • echo 'eval "$(rbenv init -)"' >> ~/.zshenv
  • echo 'eval "$(rbenv init -)"> > ~ / .zshenv
  • echo 'source $HOME/.zshenv' >> ~/.zshrc
  • echo $ HOME /的来源。> > ~ / . zshrc zshenv”
  • exec $SHELL
  • exec美元壳

#2


18  

You seem to be after installing bundler system-wide. To do this, you need to pass --no-user-install flag to gem and execute it with sudo:

您似乎在安装bundler系统范围内。为此,您需要通过—无用户安装标志到gem中并使用sudo执行:

sudo gem install bundler --no-user-install

After this, you should see bundle in /usr/bin/ just fine:

在此之后,您应该可以在/usr/bin/中看到bundle:

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

#3


7  

You can check the directory in which Rubygems will install gem executables with gem environment.

您可以检查Rubygems使用gem环境安装gem可执行程序的目录。

One of the first points should be EXECUTABLE DIRECTORY. Make sure this directory is in your $PATH (listed as SHELL PATH btw)

第一点应该是可执行目录。确保这个目录在您的$PATH中(顺便说一下,列出了SHELL PATH)

#4


1  

You shound run the below command after install bundler:

安装bundler后,您需要运行以下命令:

rbenv rehash

推荐阅读
author-avatar
美猴qing_243
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有