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

Unexpected identifier error in browserifying mqtt #417

Closed
mayooran99 opened this issue Jun 5, 2016 · 7 comments
Closed

Unexpected identifier error in browserifying mqtt #417

mayooran99 opened this issue Jun 5, 2016 · 7 comments

Comments

@mayooran99
Copy link

mayooran99 commented Jun 5, 2016

I need to use the mqtt client from the browser and I followed the following steps as mentioned in the doc.

capture

And then created a html page as specified in the doc.

capture

When I ran the commands, the browserMqtt.js got created successfully. But when I run the HTML I am getting the following error.

capture

Is there something wrong with the library?

@mayooran99 mayooran99 changed the title Unexpected indetifier error in browserifying mqtt Unexpected identifier error in browserifying mqtt Jun 6, 2016
@sandro-k
Copy link
Contributor

sandro-k commented Jun 6, 2016

@mayooran99 could you pleas expand the error given in the Console. Just copy-paste the stacktrace and the version of Chrome you are using.

@mcollina
Copy link
Member

mcollina commented Jun 6, 2016

There is something wrong with the browserify version you are using:
I got this line:

  if(length === -1 || end > this._list.length || end > this.packet.length)

@mcollina
Copy link
Member

mcollina commented Jun 6, 2016

I checked this here, and I get the same output, not sure what's up to.

@sandro-k can you have a look?

@sandro-k
Copy link
Contributor

sandro-k commented Jun 6, 2016

@mayooran99 and @mcollina I can confirm that this is a bug in https://github.com/mqttjs/mqtt-packet/blob/master/parser.js#L355 and https://github.com/mqttjs/mqtt-packet/blob/master/parser.js#L370. Somehow a char 160 ended up after if(length === -1 || end > this._list.length ||

I will create a PR

@sandro-k
Copy link
Contributor

sandro-k commented Jun 6, 2016

@mayooran99 thanks for reporting this.

@sandro-k
Copy link
Contributor

sandro-k commented Jun 6, 2016

I can confirm when forcing "mqtt-packet": "^3.4.7" I can now bundle and use mqtt.js in the browser without any issue.

@mcollina
Copy link
Member

mcollina commented Jun 6, 2016

I don't think there is a need to do a release, as we depend on mqtt-packet with the ^.
If anyone faces this issue, just zap your node_modules folder and reinstall.

@mcollina mcollina closed this as completed Jun 6, 2016
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

3 participants