var mqtt = require('mqtt'); results in error

Skip to first unread message

Sep 19, 2013, 9:45:15 AM9/19/13
Hello Experts,
I have installed node.js and then executed npm install mqtt from node.js command line to install mqtt.js.
Now to test mqtt client I am trying to execute :
var sys = require('sys');
var net = require('net');
var mqtt = require('mqtt');

var mqtt = require('mqtt'); line results in error saying:
Error: Cannot find module 'mqtt'
.     at Function.Module._resolveFilename (module.js:338:15)
.     at Function.Module._load (module.js:280:25)
.     at Module.require (module.js:364:17)
.     at require (module.js:380:17)
.     at repl:1:12
.     at REPLServer.self.eval (repl.js:110:21)
.     at repl.js:249:20
.     at REPLServer.self.eval (repl.js:122:7)
.     at Interface.<anonymous> (repl.js:239:12)
.     at Interface.EventEmitter.emit (events.js:95:17)

Could you please guide me resolving this issue.

Nicholas O'Leary

Sep 19, 2013, 10:02:02 AM9/19/13
Hi Rakesh,

this list is about the protocol, rather than any particular implementation.

At first glance, I can't see anything obviously wrong with what you say you have done.

In a clean directory, I just ran 'npm install mqtt', ran node interactively and tried a  require('mqtt') - which all worked fine.

You may want to follow-up with the guys behind the mqtt node.js module -


To learn more about MQTT please visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at
You received this message because you are subscribed to the Google Groups "MQ Telemetry Transport" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Mark Lommers

Sep 24, 2013, 7:17:08 AM9/24/13
did you do the install on the same level as where you are running the node command?

Op donderdag 19 september 2013 16:02:02 UTC+2 schreef knolleary:
Reply all
Reply to author
0 new messages