⚡
Error: Cannot find module 'dotenv/config'
Tips🔅
AWS CDKの環境構築をしてデプロイ作業をしたのですがエラーが出てしまいました😭
error code🚨
jboy422@Jboy422 cdk-lambda-ts % cdk bootstrap
Error: Cannot find module 'dotenv/config'
Require stack:
- /Users/MY_PJ/ts_pj/cdk-lambda-ts/bin/cdk-lambda-ts.ts
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/MY_PJ/ts_pj/cdk-lambda-ts/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
at Function.Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (/Users/MY_PJ/ts_pj/cdk-lambda-ts/bin/cdk-lambda-ts.ts:2:1)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module.m._compile (/Users/MY_PJ/ts_pj/cdk-lambda-ts/node_modules/ts-node/src/index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Object.require.extensions.<computed> [as .ts] (/Users/MY_PJ/ts_pj/cdk-lambda-ts/node_modules/ts-node/src/index.ts:1621:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/Users/MY_PJ/ts_pj/cdk-lambda-ts/bin/cdk-lambda-ts.ts' ]
}
Subprocess exited with error 1
dotenvがそもそもないのか?
インストールしたら治った😇
npm install dotenv
コマンドを実行:
cdk bootstrap
デプロイ成功した🙌
最後に
インフラは一歩間違えたら危ないので恐る恐る触ってます💦
Lambdaの無料枠はこちらに詳しく書いてありました。CDK自体は無料らしい?
Discussion