lsongdev / lsongdev/node-escpos

[BUG]: byte = ''; ^ SyntaxError: Unexpected token = at Module._compile (internal/modules/cjs/loader.js:723:23) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

Open
#434 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.6k
Forks
443
PR merge metrics
No merged PRs in 30d

Description

### Description of the bug

every time i run the node script, i get this error
`byte = '';
^

SyntaxError: Unexpected token =
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/home/superuser/Desktop/work/thermal_printer_example/node_modules/escpos/index.js:12:18)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
`

### Steps To Reproduce

this is my code
`const escpos = require("escpos");

// escpos.Bluetooth = require('escpos-bluetooth');
escpos.USB = require("escpos-usb");
escpos.SerialPort = require("escpos-serialport");
const serialDeviceOnLinux = new escpos.SerialPort("/dev/usb/lp2", {
baudRate: 14400,
stopBit: 2,
});

console.log(serialDeviceOnLinux);
`

### Additional Information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Node script and inspect node_modules/escpos/index.js at the require entry shown in the stack trace, including the line containing byte = ''. Check the Node.js version and the escpos dependency versions involved. Done means the script loads without the reported SyntaxError and reaches the device setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.