lsongdev / lsongdev/node-escpos

Error: Cannot find module 'escpos-usb'

Open
#317 4 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

HI.
I run code in documentation and get exception.
Could You help me, please?

(node:20296) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(node:20296) UnhandledPromiseRejectionWarning: Error: Cannot find module 'escpos-usb'
Require stack:

  • /home/slexsys/projects/esc_pos_ang/electron-quick-start/main.js
  • /home/slexsys/projects/esc_pos_ang/electron-quick-start/node_modules/electron/dist/resources/default_app.asar/main.js
  • at Module._resolveFilename (internal/modules/cjs/loader.js:961:15)
    at Function.o._resolveFilename (electron/js2c/browser_init.js:257:921)
    at Module._load (internal/modules/cjs/loader.js:844:27)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (internal/modules/cjs/loader.js:1023:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at escPos (/home/slexsys/projects/esc_pos_ang/electron-quick-start/main.js:24:18)
    at createWindow (/home/slexsys/projects/esc_pos_ang/electron-quick-start/main.js:17:3)
    at /home/slexsys/projects/esc_pos_ang/electron-quick-start/main.js:65:3
    (node:20296) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
    (node:20296) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

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

The stack trace points to electron-quick-start/main.js, especially the require at line 24; begin by checking the documented example and how it references escpos-usb. Done means the example starts without the Cannot find module error, with the required setup clearly documented.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.