Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

cannot find module Error despite depedencies being installed

オープン
#574 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
aws, javascript, node.js
領域
backend, cloud

調査の方向性

aws-node-twilio の例とそのエントリーポイントである handler.js から始め、次にローカル invoke 中に利用できる依存関係と、デプロイされた関数で利用できる依存関係を比較します。sls deploy の後に通常の invoke を実行して再現し、twilio/lib/webhooks.js が underscore を読み込めない理由を追跡します。デプロイされた例が underscore を利用できる状態で正常に invoke できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Hey folks,

Following the serverless docs for the aws-node-twilio example, I get the following message even though I installed all dependencies (tried via npm and yarn as well). I removed the node_modules directory and ran a full npm install as well and that doesn't change anything.

Weird thing is that a local invoke will work but not a 'normal' invoke eve though I did a sls deploy to make sure all the deps are deployed.

I tried with the latest twilio package but I also get an error.

Any thoughts ?

{
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module 'underscore'\nRequire stack:\n- /var/task/node_modules/twilio/lib/webhooks.js\n- /var/task/node_modules/twilio/lib/index.js\n- /var/task/handler.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
    "trace": [
        "Runtime.ImportModuleError: Error: Cannot find module 'underscore'",
        "Require stack:",
        "- /var/task/node_modules/twilio/lib/webhooks.js",
        "- /var/task/node_modules/twilio/lib/index.js",
        "- /var/task/handler.js",
        "- /var/runtime/UserFunction.js",
        "- /var/runtime/index.js",
        "    at _loadUserApp (/var/runtime/UserFunction.js:100:13)",
        "    at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)",
        "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
        "    at Module._compile (internal/modules/cjs/loader.js:1015:30)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)",
        "    at Module.load (internal/modules/cjs/loader.js:879:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:724:14)",
        "    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)",
        "    at internal/main/run_main_module.js:17:47"
    ]
}
 
  Error --------------------------------------------------
 
  Error: Invoked function failed
      at AwsInvoke.log (/snapshot/serverless/lib/plugins/aws/invoke/index.js:100:31)
  From previous event:
      at Object.invoke:invoke [as hook] (/snapshot/serverless/lib/plugins/aws/invoke/index.js:23:12)
      at /snapshot/serverless/lib/classes/PluginManager.js:521:55
  From previous event:
      at PluginManager.invoke (/snapshot/serverless/lib/classes/PluginManager.js:521:22)
      at /snapshot/serverless/lib/classes/PluginManager.js:556:24
  From previous event:
      at PluginManager.run (/snapshot/serverless/lib/classes/PluginManager.js:556:8)
      at /snapshot/serverless/lib/Serverless.js:203:33
      at processImmediate (internal/timers.js:456:21)
      at process.topLevelDomainCallback (domain.js:137:15)
  From previous event:
      at Serverless.run (/snapshot/serverless/lib/Serverless.js:190:74)
      at /snapshot/serverless/scripts/serverless.js:50:26
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              12.18.1
     Framework Version:         2.15.0 (standalone)
     Plugin Version:            4.2.0
     SDK Version:               2.3.2
     Components Version:        3.4.3
主要言語
JavaScript
スター
11.5k
フォーク
4.4k
平均マージ
2時間 55分
マージ済み PR(30日)
3

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

serverless/examples のほかの issue

serverless/examples の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。