I am trying to run the code:
mqtt sub -t 'hello' -h 'test.mosquitto.org' -v
But I am getting the following error:
Error: Cannot find module './bin/pub'
The issue goes away when I change the require from ./bin/pub to ./pub
The same thing happens to require('./bin/sub').
Here is the full error message:
PS C:\Users\MNunes\mqtt_react-test> mqtt pub -t 'hello' -h 'test.mosquitto.org' -m 'from MQTT.js'
internal/modules/cjs/loader.js:1032
throw err;
^
Error: Cannot find module './bin/pub'
Require stack:
C:\Users\MNunes\AppData\Roaming\npm\node_modules\mqtt\bin\mqtt.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous> (C:\Users\MNunes\AppData\Roaming\npm\node_modules\mqtt\bin\mqtt.js:14:29)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\MNunes\\AppData\\Roaming\\npm\\node_modules\\mqtt\\bin\\mqtt.js'
]
}
Is it supposed to work with require('./bin/pub') ?
If yes, could you explain if I have done something wrong?
Just noticed there is a fix for this - https://github.com/mqttjs/MQTT.js/pull/1107
I will wait for the next release. Thanks!
me too bro,
C:\Users\password-123>mqtt -v
internal/modules/cjs/loader.js:969
throw err;
^
Error: Cannot find module './bin/pub'
Require stack:
I just installed it from npm. The bug still exists.
I use v4.0.0 until the next release.
npm install -g [email protected]
confused why the changes are not in the release...
oh we just haven't released yet. Keeping open till next release goes out.
thank for your kindness :-D
On Wed, Jul 29, 2020 at 11:51 PM Yoseph Maguire notifications@github.com
wrote:
oh we just haven't released yet. Keeping open till next release goes out.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/mqttjs/MQTT.js/issues/1113#issuecomment-665793908,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKRNYNIOPUYFPMBMDXGOZKTR6BLADANCNFSM4OB7L3SQ
.
Most helpful comment
me too bro,
C:\Users\password-123>mqtt -v
internal/modules/cjs/loader.js:969
throw err;
^
Error: Cannot find module './bin/pub'
Require stack:
[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:842:27)[39m
[90m at Module.require (internal/modules/cjs/loader.js:1026:19)[39m
[90m at require (internal/modules/cjs/helpers.js:72:18)[39m
at Object.
[90m at Module._compile (internal/modules/cjs/loader.js:1138:30)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:986:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:879:14)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)[39m {
code: [32m'MODULE_NOT_FOUND'[39m,
requireStack: [
[32m'C:\Users\password-123\AppData\Roaming\npm\node_modules\mqtt\bin\mqtt.js'[39m
]
}