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)
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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