Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer is not defined #118

Closed
wsw70 opened this issue Jun 22, 2021 · 1 comment
Closed

Buffer is not defined #118

wsw70 opened this issue Jun 22, 2021 · 1 comment

Comments

@wsw70
Copy link

wsw70 commented Jun 22, 2021

This issue was initially raised at mqttjs/MQTT.js#1294 but the error seems to point to mqtt-packet. I wil synchronize both if there is a solution

When importing MQTT.js to a VueJS/Quasar app, I get the following error:

app.js:216 Uncaught ReferenceError: Buffer is not defined
    at eval (constants.js?885d:46)
    at Object../node_modules/mqtt-packet/constants.js (vendor.js:1729)
    at __webpack_require__ (app.js:213)
    at fn (app.js:477)
    at eval (parser.js?7aac:4)
    at Object../node_modules/mqtt-packet/parser.js (vendor.js:1779)
    at __webpack_require__ (app.js:213)
    at fn (app.js:477)
    at eval (mqtt.js?e7bd:1)
    at Object../node_modules/mqtt-packet/mqtt.js (vendor.js:1749)
eval @ constants.js?885d:46
./node_modules/mqtt-packet/constants.js @ vendor.js:1729
__webpack_require__ @ app.js:213
fn @ app.js:477
eval @ parser.js?7aac:4
./node_modules/mqtt-packet/parser.js @ vendor.js:1779
__webpack_require__ @ app.js:213
fn @ app.js:477
eval @ mqtt.js?e7bd:1
./node_modules/mqtt-packet/mqtt.js @ vendor.js:1749
__webpack_require__ @ app.js:213
fn @ app.js:477
eval @ client.js?9905:8
./node_modules/mqtt/lib/client.js @ vendor.js:1800
__webpack_require__ @ app.js:213
fn @ app.js:477
eval @ index.js?4c91:3
./node_modules/mqtt/lib/connect/index.js @ vendor.js:1822
__webpack_require__ @ app.js:213
fn @ app.js:477
eval @ index.js??clonedRuleSet-3.use[0]!./node_modules/@quasar/app/lib/webpack/loader.vue.auto-import-quasar.js??ruleSet[0].use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[1]!./src/App.vue?vue&type=script&lang=ts:6
./node_modules/@quasar/app/lib/webpack/loader.js.transform-quasar-imports.js!./node_modules/ts-loader/index.js??clonedRuleSet-3.use[0]!./node_modules/@quasar/app/lib/webpack/loader.vue.auto-import-quasar.js??ruleSet[0].use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[1]!./src/App.vue?vue&type=script&lang=ts @ app.js:63
__webpack_require__ @ app.js:213
fn @ app.js:477
eval @ App.vue?vue&type=script&lang=ts:5
./src/App.vue?vue&type=script&lang=ts @ app.js:134
__webpack_require__ @ app.js:213
fn @ app.js:477
eval @ App.vue:6
./src/App.vue @ app.js:96
__webpack_require__ @ app.js:213
fn @ app.js:477
eval @ app.js:6
./.quasar/app.js @ app.js:19
__webpack_require__ @ app.js:213
fn @ app.js:477
eval @ client-entry.js:11
./.quasar/client-entry.js @ app.js:30
__webpack_require__ @ app.js:213
(anonymous) @ app.js:1387
__webpack_require__.O @ app.js:260
(anonymous) @ app.js:1388
(anonymous) @ app.js:1390

I tried (more or less randomly, after finding a similar issue) to

npm install Buffer

which chnaged the error to

Uncaught TypeError: Buffer.alloc is not a function
    at eval (constants.js?885d:128)
    at Array.map (<anonymous>)
    at eval (constants.js?885d:127)
    at Array.map (<anonymous>)
    at eval (constants.js?885d:126)
    at Array.map (<anonymous>)
    at genHeader (constants.js?885d:125)
    at eval (constants.js?885d:140)
    at Object../node_modules/mqtt-packet/constants.js (vendor.js:1707)
    at __webpack_require__ (app.js:213)

Please let me know if I can help with the debug.

@wsw70
Copy link
Author

wsw70 commented Jun 22, 2021

Solution in the initial issue (see the first line of the issue)

@wsw70 wsw70 closed this as completed Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant