
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
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










Other popular topics









Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /scala
- /html
- /zig
- /debian
- /nixos
- /lisp
- /agda
- /textmate
- /react-native
- /sublime-text
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /lua
- /nodejs
- /julia
- /slackware
- /c
- /neovim