lsongdev / lsongdev/node-escpos

Statuses.js error

Open
#306 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello,
I'm encountering the issue below

![image](https://user-images.githubusercontent.com/56196555/90857436-ca77d900-e38c-11ea-9681-18191404d443.png)

**My background.js is as follows**

![image](https://user-images.githubusercontent.com/56196555/90857563-10cd3800-e38d-11ea-9a39-766ddb8b2e29.png)

I have checked #297 and tried the fix but it hasn't worked for me

I am using this tutorial -> https://medium.com/@nyorikakar/printing-with-vue-electron-and-node-f52a730e63e7

### Environment

- yarn 1.22.4
- escpos 3.0.0-alpha.6
- escpos-usb 3.0.0-alpha.4

### Steps to reproduce:

1. Install electron builder `vue add electron-builder`
2. Install escpos `yarn add escpos`
3. Add escpos to background.js
4. Run `yarn electron:serve`

### **Full Error Stack**

`⠹ Bundling main process...`
` ERROR Failed to compile with 1 errors 9:02:13 AM`
`error in ./node_modules/escpos/statuses.js`
`Module parse failed: Unexpected token (7:7)`
`You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders`
`|`
`| class DeviceStatus {`
`> byte = '';`
`| bits = [];`
`| bitsAsc = [];`

`@ ./node_modules/escpos/index.js 12:17-38`
`@ ./src/background.js`
`@ multi ./src/background.js`

`ERROR Build failed with errors.`
`error Command failed with exit code 1.`
`info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

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 with src/background.js and the failing dependency node_modules/escpos/statuses.js, then reproduce the error with yarn electron:serve. Check how the Electron builder handles the class fields shown in statuses.js and compare the result with issue #297. Done means the main process bundles without the parse error while escpos remains usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, javascript, nodejs, webpack
Domain
build-system, desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.