Borislav Hadzhiev
Last updated: Apr 14, 2022
Check out my new book
There are two common reasons why we usually get the "Cannot find module" Error in CDK:
node_modules
directory and run npm install
againI 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:
In order to solve the "Cannot find Module Error" in CDK, 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.