getting error on require
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
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 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