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 Prag Prog topics Top

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
Razor54672
The answer to 3rd Problem of Chapter 5 (Making Choices) of “Practical Programming, Third Edition” seems incorrect in the given answer ke...
New
ianwillie
Hello Brian, I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
New
yulkin
your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
New
edruder
I thought that there might be interest in using the book with Rails 6.1 and Ruby 2.7.2. I’ll note what I needed to do differently here. ...
New
conradwt
First, the code resources: Page 237: rumbl_umbrella/apps/rumbl/mix.exs Note: That this file is missing. Page 238: rumbl_umbrella/app...
New
adamwoolhether
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
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
ggerico
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1: programming_ML/code/03_...
New
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New

Other popular topics Top

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
PragmaticBookshelf
A PragProg Hero’s Journey with Brian P. Hogan @bphogan Have you ever worried that your only legacy will be in the form of legacy...
New
New
AstonJ
You might be thinking we should just ask who’s not using VSCode :joy: however there are some new additions in the space that might give V...
New
Exadra37
I am a Linux user since 2012, more or less, and I always use Ubuntu on my computers, and my last 2 laptops have been used Thinkpads, wher...
New
mafinar
Crystal recently reached version 1. I had been following it for awhile but never got to really learn it. Most languages I picked up out o...
New
Margaret
Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
1127 25275 746
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
PragmaticBookshelf
A Ruby-Centric Chat with Noel Rappin @noelrappin Once you start noodling around with Ruby you quickly figure out, as Noel Rappi...
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
New

Latest in PragProg

View all threads ❯