LoginSignup
1
2

More than 5 years have passed since last update.

Hubotのエラー Cannot find module の解決法

Last updated at Posted at 2016-08-14

惚れさせ男子データベースから地獄のミサワ画像を返すHubotがあると知って、手持ちのHubotに機能を追加しようと思ったけど、タイトルのエラーで詰まりかけたので投稿しました。

npm
https://www.npmjs.com/package/hubot-misawa

上記のURLに使い方とかが書いてあります。

機能追加の手順
1.npm install hubot-misawa --save ←ここでハマりました。
2."hubot-misawa" を 作成したHubotのルートディレクトリ直下にあるexternal-scripts.json に追加
3.Hubotを再度デプロイ
4.Hubotを再起動

ERROR Error loading scripts from npm package - Error: Cannot find module 'hubot-misawa'

以前作成したIBM Bluemix の Hubotを手順に沿って、改修したところ、異常終了したので以下のコマンドを発行し、エラーが出ていることを確認。
cf logs hubotdev --recent

解決策

node_modules直下で以下のコマンドをコマンドプロンプトで発行して、再度デプロイする

作成したhubot名\node_modules>npm install hubot-misawa --save

どうやら、
npm install hubot-misawa --save
は試した限りではアプリごとにインストールしないとダメみたいです。
Linuxのyumコマンドみたいにインストールしたら、どっからでも使えるわけではない様子。

うまく解決できたら・・・

Slackで動作確認する場合
@作成したHubot名 misawa
でランダムにミサワ画像が取得できるようになります。

1
2
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
1
2