alexa-samples / skill-sample-nodejs-adventure-game

This tool provides an easy to use front-end that allows developers to instantly deploy code for your story, or use the generated code as a starting point for more complex projects.
Apache License 2.0
510 stars 218 forks source link

Cannot find module 'alexa-sdk' #79

Open thormon opened 5 years ago

thormon commented 5 years ago

Hi,

I followed the tutorial but am kind of lost now. I tried to test the example inside Lambda and get the following error message: { "errorMessage": "Cannot find module 'alexa-sdk'", "errorType": "Error", "stackTrace": [ "require (internal/module.js:11:18)", "Object. (/var/task/index.js:3:15)", "Module._compile (module.js:652:30)", "Object.Module._extensions..js (module.js:663:10)", "Module.load (module.js:565:32)", "tryModuleLoad (module.js:505:12)", "Function.Module._load (module.js:497:3)" ] }

I new to all of this and a little confused. As I understood it this is related to node.js, which I installed. After that I tried to install the alexa sdk via console using "npm install --save alexa-sdk". Since I still get this error I think it did not work. As a last resort I included the sdk inside the .zip that is supposed to be uploaded. What am I supposed to do now?

gbalta commented 5 years ago

I am also a beginner, but I finally got it to work. Here are the steps I took:

Download and install the latest version of node.js Go to https://github.com/alexa/skill-sample-nodejs-adventure-game and download the zip file Extract this zip file into folder of the same name Open a command prompt and navigate to the subfolder lambda\custom In the command prompt type "npm install --save alexa-sdk" lambda\custom now contains a folder called "node_modules" Within the node_modules folder, delete "aws-sdk" because it makes the zip file too big Now zip the contents of lambda\custom and upload this zip file into Lambda make sure index.js and all the other files of lambda\custom are placed in the root folder of your function Also make sure that the APP_ID is defined under environment variables Do a test of the function as described in the tutorial