cannot find module Error despite depedencies being installed
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- aws, javascript, node.js
Hướng nghiên cứu
Bắt đầu với ví dụ aws-node-twilio và entry point handler.js của nó, sau đó so sánh các dependency có sẵn trong quá trình invoke cục bộ với các dependency trong function đã được triển khai. Tái hiện bằng sls deploy, sau đó thực hiện một invoke thông thường và theo dõi lý do twilio/lib/webhooks.js không thể tải underscore. Hoàn thành khi ví dụ đã triển khai invoke thành công với underscore có sẵn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- JavaScript
- Star
- 11.5k
- Fork
- 4.4k
- Merge trung bình
- 2 giờ 55 phút
- Pull request đã merge (30 ngày)
- 3
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của serverless/examples
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
serverless/examples#404 ·
-
ENOTDIR error on starter project Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
serverless/examples#809 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
serverless/examples#793 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
serverless/examples#784 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
serverless/examples#782 ·
Tất cả issue của serverless/examples
Issue tương tự
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Automattic/safe-publish#594 ·
-
内部文件键(绝对路径的 base64)泄漏到界面标签 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
dream-num/dsh-univer-office#104 ·
-
comp/dashboard invalid P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
NousResearch/hermes-agent#121143 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
avniproject/avni-webapp#1811 ·
-
area/auroraboot area/webui bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100