Error: Cannot find module '@xmpp/client'


#1

I’m a bit of a node-newb, sorry if this is a simple mistake. I would be grateful for assistance. After attempting to include an xmpp package, it seemed like the interface recognized and even adjusted the version string in the package.json file. Nonetheless, one the require call is made, fail and this in the logs:

Error: Cannot find module '@xmpp/client’
2:34 PM
at Function.Module._resolveFilename (module.js:527:15)
2:34 PM
at Function.Module._load (module.js:476:23)
2:34 PM
at Module.require (module.js:568:17)
2:34 PM
at require (internal/module.js:11:18)
2:34 PM
Jump to
at /app/server.js:25:18
2:34 PM
at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2:34 PM
at next (/app/node_modules/express/lib/router/route.js:137:13)
2:34 PM
at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2:34 PM
at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2:34 PM
at /app/node_modules/express/lib/router/index.js:281:22
2:34 PM


#2

Please share your project name so we can take a look at your code.


#3

Sorry, should have been the first thing I posted


#4

Ah, it looks like the linked documentation for the node-xmpp-client package refers to a setup that doesn’t use that package. It’s assuming you’re using xmpp.js and so the require to '@xmpp/client’ is incorrect. I’ve fixed it up in your project. Docs with a simple, working example, can be found at https://github.com/chris-rock/node-xmpp-client instead.


#5

Thanks, Gareth, your fix plus using the actual correct password got it fixed and logged in. But I’m confused about the document links. And the npm repository relationships and the Github repo relationships. How did you find the chris-rock edition?
Thanks again for your help.


#6

You referenced the package node-xmpp-client in your package.json code, so I searched for that on npm once I realised you weren’t requiring it to see what’s up.