2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Last updated at Posted at 2019-12-25

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'); 
2
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?