bundle: command not found中有一个类似的问题,但我找不到答案。
我们使用以下Ansible脚本安装打包程序:
- name: Install gems
gem: name={{ item }} state=present
become: no
with_items:
- bundler
这似乎可行,因为在安装之前,从宝石列表中可以找到
:$ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.8)
CFPropertyList (2.2.8)
did_you_mean (1.0.0)
io-console (0.4.5)
json (1.8.3)
libxml-ruby (2.9.0)
minitest (5.8.5)
net-telnet (0.1.1)
nokogiri (1.5.6)
power_assert (0.2.6)
psych (2.1.0)
rake (10.4.2)
rdoc (4.2.1)
sqlite3 (1.3.11)
test-unit (3.1.5)
,并在运行ansible脚本后:
$ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.8)
bundler (1.16.6)
CFPropertyList (2.2.8)
did_you_mean (1.0.0)
io-console (0.4.5)
json (1.8.3)
libxml-ruby (2.9.0)
minitest (5.8.5)
net-telnet (0.1.1)
nokogiri (1.5.6)
power_assert (0.2.6)
psych (2.1.0)
rake (10.4.2)
rdoc (4.2.1)
sqlite3 (1.3.11)
test-unit (3.1.5)
请注意,bundler (1.16.6)
已添加到列表中。
但是,当尝试使用它时,它显示未找到:
$ bundle
-bash: bundle: command not found
然后我尝试直接从命令行重新安装:
$ gem install bundler
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
然后我检查一下,看来捆绑器不在该文件夹中。
$ ls /Library/Ruby/Gems/2.3.0/gems/
did_you_mean-1.0.0 power_assert-0.2.6 test-unit-3.1.5
minitest-5.8.5 rake-10.4.2
net-telnet-0.1.1 rdoc-4.2.1
这很令人困惑,ansible安装在哪里bundler
?
P.S。
通过以下方法直接安装捆绑程序确实可以正常工作:
$ sudo gem install bundler
Fetching: bundler-1.16.6.gem (100%)
Successfully installed bundler-1.16.6
Parsing documentation for bundler-1.16.6
Installing ri documentation for bundler-1.16.6
Done installing documentation for bundler after 5 seconds
1 gem installed
$ bundle --version
Bundler version 1.16.6
但是,我们希望通过ansible来安装它,以实现自动化。