Friday 10 December 2021

Error: Cannot find module aws-sdk

 So I don't program daily and Visual Studio Code is still pretty new to me. I came across this issue when I was trying to code for lambda function but VS Code kept giving me this error and I couldn't figure out how to resolve it. I found something on a forum that seemed to work, but I had to read a lot to find it. 

So here is a snippet of my code:

var AWS = require('aws-sdk');
AWS.config.update({region: 'us-east-1'});
var async = require('async')



Go to terminal and type this:

 npm link aws-sdk

That should fix the issue by creating a symbolic link for node in your workspace, then VS code won't complain. If it errors out for async, repeat the process for async. You should be good to go. 

No comments:

Post a Comment