gem: command not found

只愿长相守 提交于 2020-01-03 04:49:05

问题


I have bash file which build gem files and launch my program:

cd /src/stackify-api
rm *.gem
gem build stackify.gemspec
gem install stackify-0.1.0.gem

cd /src/stackify-classificator
rm *.gem
gem build stackify-classificator.gemspec
gem install stackify-classificator-0.1.1.gem

cd /src/bin
ruby console-task.rb

I use it in the docker container. It works fine if I launch the container interactively and run this bash-file manually:

 ~ » docker run -it -v /mnt/lacie/online/btsync/development:/src stack_rvm /bin/bash              
root@898cec6a7d85:/# /src/build.sh 
  ...
  Successfully built RubyGem
  Name: stackify
  Version: 0.1.0
  File: stackify-0.1.0.gem

But when I am trying to launch this script in the docker like this I get the error message:

 ~ » docker run -it -v /mnt/lacie/online/btsync/development:/src stack_rvm /bin/bash /src/build.sh
/src/build.sh: line 5: gem: command not found

Why and how can I fix it ?


回答1:


I have found the answer - use -c -l:

~ » docker run -it -v /mnt/lacie/online/btsync/development:/src stack_rvm /bin/bash -c -l /src/build.sh



回答2:


For me, it was that C:\Ruby24-x64\bin was added to the Path user variable and not the Path system variable during the Ruby installation. Once I added C:\Ruby24-x64\bin to the Path system variable, everything worked fine.



来源:https://stackoverflow.com/questions/29998746/gem-command-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!