alexa-samples / skill-sample-nodejs-fact

Build An Alexa Fact Skill
Apache License 2.0
1.15k stars 1.19k forks source link

Cannot find module 'alexa-sdk'" error at LAMDA FUNCTION #33

Closed JOSEPHREDDY07 closed 6 years ago

JOSEPHREDDY07 commented 7 years ago

I'm new to Alexa skills, I fallowed all the steps. Here's the error I get on this line "var Alexa = require("alexa-sdk");". Am I doing something wrong? Or is there some configuration setting I need to do?

{ "errorMessage": "Cannot find module 'alexa-sdk'",

robwhite4 commented 7 years ago

You should fire up a terminal (as administrator) and ->

cd <my/project/dir>
npm install

This will install the project deps (from the package.json file) into a node_modules directory from which your project can access them.

See: https://docs.npmjs.com/cli/install for more.

Hope this helps.

Good luck! 👍

robwhite4 commented 7 years ago

Also, I guess you are coding your function on Lambda directly. I can't guide you in requiring external libraries on lambda from their code editor. I use serverless to package and deploy my lambda functions.

There are others, but I haven't played with them much; which are:

(..there are more but I can't think of them atm..)

It takes a little more work, but these tools allow you to use your local setup to code up these items.

Maybe this will also be of assistance to you.

Thanks.