Last updated: Jan 26, 2024
Reading time·2 min
There are two common reasons why we usually get the "Cannot find module" Error in CDK:
node_modules
directory and run npm install
again.I was working on a project yesterday where I had all of the necessary dependencies but I kept getting the error one package name after another:
To solve the error, we have to:
npm ls
command to list all packages, or just go through your
package.json
file.node_modules
directory
and run the install
command again:# 👇️ delete node_modules and package-lock.json rm -rf node_modules rm -f package-lock.json # 👇️ clean npm cache npm cache clean --force npm install
npm install --save-exact @aws-cdk/aws-dynamodb@latest
To test whether the issue is resolved - run the npx aws-cdk synth
command.
You can learn more about the related topics by checking out the following tutorials: