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.

Where Next?

Popular Pragmatic Bookshelf 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
johnp
Hi Brian, Looks like the api for tinydb has changed a little. Noticed while working on chapter 7 that the .purge() call to the db throws...
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
raul
Hi Travis! Thank you for the cool book! :slight_smile: I made a list of issues and thought I could post them chapter by chapter. I’m rev...
New
Mmm
Hi, build fails on: bracket-lib = “~0.8.1” when running on Mac Mini M1 Rust version 1.5.0: Compiling winit v0.22.2 error[E0308]: mi...
New
herminiotorres
Hi! I know not the intentions behind this narrative when called, on page XI: mount() |> handle_event() |> render() but the correc...
New
digitalbias
Title: Build a Weather Station with Elixir and Nerves: Problem connecting to Postgres with Grafana on (page 64) If you follow the defau...
New
s2k
Hi all, currently I wonder how the Tailwind colours work (or don’t work). For example, in app/views/layouts/application.html.erb I have...
New
rainforest
Hi, I’ve got a question about the implementation of PubSub when using a Phoenix.Socket.Transport behaviour rather than channels. Before ...
New
New

Other popular topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
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
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New
AstonJ
Continuing the discussion from Thinking about learning Crystal, let’s discuss - I was wondering which languages don’t GC - maybe we can c...
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
New
DevotionGeo
I have always used antique keyboards like Cherry MX 1800 or Cherry MX 8100 and almost always have modified the switches in some way, like...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New
AstonJ
This is cool! DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON We just witnessed something incredible: the largest open-s...
New

Sub Categories: