我已经安装了“node.js”,然后从“node.js”命令行执行“ npm install mqtt ”来安装“mqtt.js”。现在要测试“mqtt 客户端”,我正在尝试执行: var mqtt = require('mqtt'); 这导致错误说:
"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)"