Skip to content

Node Setup

Bankn8II©$A edited this page May 17, 2025 · 1 revision

Step 1. Install the node-canvas dependencies

JsBarcode for Node.js is dependent on node-canvas to work. It does have some dependencies outside of npm to work. Make sure to install them by following the instructions in their readme.

Step 2. Install JsBarcode and node-canvas

npm install canvas
npm install jsbarcode

Step 3. Use it!

const JsBarcode = require('jsbarcode');
const { Canvas } = require("canvas");

const canvas = new Canvas();
JsBarcode(canvas, "Hello");

// Do what you want with the canvas
// See https://github.com/Automattic/node-canvas for more information

Clone this wiki locally