LoginSignup
0
1

More than 3 years have passed since last update.

bundler: command not found: clockwork でclockworkコマンド実行に失敗した際の対処法

Last updated at Posted at 2020-04-24

bundler: command not found: clockwork でコマンド実行に失敗した際の対処法

背景

3分おきに実行する定期実行スクリプトを作成するためにclockwork というgemを利用しました。

その際の対処法を覚え書きとして記載。

エラー
$ bundle exec clockwork ファイル名.rb;
bash: clockwork: command not found

目次


動作環境

OS : macOS Mojave 10.14.6
ruby : 2.6.3p62
rails : 5.2.4

結論

以下のコマンドを打つと実行できました。

解決法
bundle exec clockwork ファイル名.rb;

原因

色々調べてみると。

bundle exec をつけた場合、プロジェクトフォルダ内部にあるパッケージを利用
つけない場合、PCにインストールされているものを利用

つまりエラーの原因は
PC自体にclockworkのgemがインストールされていなかったため

image.png

ためしにPCにインストールすると無事にbundle execなしでも実行できました。

image.png

おわりに

今回の件で以下のことを学びました。
1. gemfileはプロジェクトで利用するgemパッケージを記述したものであり、PCにインストールされているgemとは必ずしもイコールではないということ。
2. gemfilebundlerによって管理されていること

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1