Quantcast
Channel: Node.jsタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 8833

Node.jsの"Error: Cannot find module 'cfn-response'"の解決方法

$
0
0

Error: Cannot find module 'cfn-response'

Lambda-Backedカスタムリソースにおいて、Node.js 8がEOLとなるため、コードはそのままでランタイムの指定だけをNode.js 12.xに変更したところ、このようなエラーが発生しました。

Response:
{
  "errorType": "Runtime.ImportModuleError",
  "errorMessage": "Error: Cannot find module 'cfn-response'",
  "trace": [
    "Runtime.ImportModuleError: Error: Cannot find module 'cfn-response'",
  云々

Node.js 8では以下の指定で同じ階層のファイルrequireできるのですが、

Node.js8
const response = require('cfn-response'); 

Node.js 12では、パスを明記する必要があるようです。

Node.js12
const response = require('./cfn-response'); 

Viewing all articles
Browse latest Browse all 8833

Trending Articles