kibbage

kibbage

Build Talking Apps for Alexa: Can't find i18next module (page 23)

@habuma
I am running on Windows 11 with VS Code. I make all of the internationalization changes to the code. Then I open the command prompt and enter “npm install --prefix lambda i18next” while in the lambda directory. This creates another “lambda” directory to the current “lambda” directory and when I try to deploy and test the program I get “i18next” module is not found. I remove the sub-directory lambda and run the same npm command from the parent directory and everything looks good but again the i18next module can’t be found by the skill. I can see the folders and code in the lambda/node_modules sub-directory. I gave up and removed the i18next features and hard coded the responses. What did I do wrong?

First Post!

habuma

habuma

Author of Build Talking Apps for Alexa

Long answer follows…I’m thinking out loud here, hoping to arrive at a solution for you…

When you run npm install with --prefix you are giving it a path to where the Node project is located. If you don’t specify the --prefix parameter, it defaults to the current directory.

If you are in the Alexa project’s lambda directory, you don’t need (and shouldn’t use) the --prefix parameter because you are already in the part of the project that is the Node project. It will just add the dependency to the package.json in the current directory.

If you are in the Alexa project’s root, then you must use --prefix or it will try to put it into a package.json file in the current directory. And when it doesn’t find one, it will install it in a node_modules directory at your user’s home directory (which works for some use cases, but not so much when you plan to deploy and run your code somewhere other than your own machine).

So, you can either use --prefix from the Alexa project’s root or not use it if you are already in the lambda directory.

But you said you did it first with --prefix in the lambda directory and that created a new lambda directory. That’s not what you want, of course, but that is what I’d expect to happen. So you deleted that new lambda and did it again from the root (presumably with --prefix). You say that after doing that you see all of the modules in lambda/node_modules, so that all sounds right. May I assume that you see everything listed in lambda/package.json?

If so, then I can’t imagine it not working after you deploy it again. Assuming that you’re doing an Alexa-hosted skill, that means git commit of your changes…if AWS-hosted, then ask deploy.

In the Alexa-hosted case, you might need to give it a minute after the commit for the changes to be picked up. It’s not instantaneous. There’s a CI system that sees the commit changes and then deploys them. All together, I’ve seen it take several minutes on a slow day. One thing I’d do is go into the developer console, go to the “Code” tab, and inspect the package.json and relevant .js files there to see if Alexa has picked them up yet. If not, then wait a bit longer. If they are there, I’d maybe try deploying from the dev console (e.g., push the “Deploy” button at the top right) and waiting for that to complete. Also, note any warnings that might appear at the top of the page of the Code tab. (Note them, but then wait a minute or so and refresh to page to see if they go away on their own.)

If that still doesn’t work, then I’m stumped (well, mostly).

Try that stuff first and if you still have trouble, ping me again. I have some other ideas, but don’t want to make this reply any longer than it already is if the most common things will help you.

Popular Pragmatic Bookshelf topics Top

abtin
page 20: … protoc command… I had to additionally run the following go get commands in order to be able to compile protobuf code using go...
New
jimmykiang
This test is broken right out of the box… — FAIL: TestAgent (7.82s) agent_test.go:77: Error Trace: agent_test.go:77 agent_test.go:...
New
jimschubert
In Chapter 3, the source for index introduces Config on page 31, followed by more code including tests; Config isn’t introduced until pag...
New
jamis
The following is cross-posted from the original Ray Tracer Challenge forum, from a post by garfieldnate. I’m cross-posting it so that the...
New
jdufour
Hello! On page xix of the preface, it says there is a community forum "… for help if your’re stuck on one of the exercises in this book… ...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
HarryDeveloper
Hi @venkats, It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
New
AufHe
I’m a newbie to Rails 7 and have hit an issue with the bin/Dev script mentioned on pages 112-113. Iteration A1 - Seeing the list of prod...
New
taguniversalmachine
Hi, I am getting an error I cannot figure out on my test. I have what I think is the exact code from the book, other than I changed “us...
New
EdBorn
Title: Agile Web Development with Rails 7: (page 70) I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
New

Other popular topics Top

ohm
Which, if any, games do you play? On what platform? I just bought (and completed) Minecraft Dungeons for my Nintendo Switch. Other than ...
New
DevotionGeo
I know that these benchmarks might not be the exact picture of real-world scenario, but still I expect a Rust web framework performing a ...
New
axelson
I’ve been really enjoying obsidian.md: It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
New
AstonJ
poll poll Be sure to check out @Dusty’s article posted here: An Introduction to Alternative Keyboard Layouts It’s one of the best write-...
New
AstonJ
We have a thread about the keyboards we have, but what about nice keyboards we come across that we want? If you have seen any that look n...
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
New
AstonJ
If you are experiencing Rails console using 100% CPU on your dev machine, then updating your development and test gems might fix the issu...
New
PragmaticBookshelf
Build highly interactive applications without ever leaving Elixir, the way the experts do. Let LiveView take care of performance, scalabi...
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New