lindell / lindell/JsBarcode

getting error on require

Open
#323 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5.9k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

var JsBarcode = require('jsbarcode');
const { createCanvas } = require('canvas');

const canvas = createCanvas(0, 0);

// create a bar code with the number/text I want and populate the canvas with it..
JsBarcode(canvas, '123456');

Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.

var JsBarcode = require('jsbarcode');
~~~~~~~
src/app/app.component.ts:21:30 - error TS2591: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.

const { createCanvas } = require('canvas');

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 reproducing the TypeScript errors in src/app/app.component.ts using the require calls shown in the report, then inspect the project's tsconfig and Node type setup. Confirm that the JsBarcode and canvas imports compile without the reported Cannot find name 'require' errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.